Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Open shared spaces: free collaboration, post-signup join screen, idle sync backoff (#1549)

Gabriel Stein46e45518eab4
diff --git a/src/components/AcceptInvitationModal.tsx b/src/components/AcceptInvitationModal.tsx
index 1a670a68e..51145c1e2 100644
--- a/src/components/AcceptInvitationModal.tsx
+++ b/src/components/AcceptInvitationModal.tsx
@@ -15,10 +15,10 @@ import {
storePendingInvitationToken,
clearPendingInvitationToken,
} from "../utils/pendingInvitationToken";
-import { useWorkspaceStore } from "../stores/workspaceStore";
import { useAuth } from "../hooks/useAuth";
import { signOut } from "../lib/auth";
import { syncService } from "../services/SyncService.js";
+import { afterWorkspaceJoined } from "../services/membershipActions";
import { useToast } from "./ui/useToast";
import SignInDialog from "./SignInDialog";
import type { InvitationPreview } from "../types/electron";
@@ -33,7 +33,6 @@ export default function AcceptInvitationModal({ token, onClose, onAccepted }: Pr
const { t } = useTranslation();
const { toast } = useToast();
const { isSignedIn, user } = useAuth();
- const refresh = useWorkspaceStore((s) => s.refresh);
const [preview, setPreview] = useState<InvitationPreview | null>(null);
const [loading, setLoading] = useState(false);
const [accepting, setAccepting] = useState(false);
@@ -81,14 +80,7 @@ export default function AcceptInvitationModal({ token, onClose, onAccepted }: Pr
try {
const accepted = await InvitationsService.accept(token);
clearPendingInvitationToken();
- await refresh();
- // A free invitee just gained a billable seat server-side; refetch usage
- // so the isSubscribed flag flips and team sync can run (the flag flip
- // itself kicks another sync pass).
- window.dispatchEvent(new Event("usage-changed"));
- // Pull the just-granted team spaces right away (skeleton rows render
- // while their backfill is pending).
- syncService.requestSyncAll("manual");
+ await afterWorkspaceJoined();
toast({
title: t("workspaces.accept.successTitle"),
description: preview
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 81bf602b5..9fad6b4a3 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -20,6 +20,7 @@ import { useToast } from "./ui/useToast";
import { useUpdater } from "../hooks/useUpdater";
import { useSettings } from "../hooks/useSettings";
import { useAuth } from "../hooks/useAuth";
+import { useJoinableWorkspaces } from "../hooks/useJoinableWorkspaces";
import { useUsage } from "../hooks/useUsage";
import { decideUpsell } from "../lib/upsell";
import { useCollapsibleSidebar } from "../hooks/useCollapsibleSidebar";
@@ -68,6 +69,7 @@ import SpaceSyncToastListener from "./notes/SpaceSyncToastListener";
import { syncService } from "../services/SyncService.js";
import logger from "../utils/logger";
import AcceptInvitationModal from "./AcceptInvitationModal";
+import JoinYourTeamModal from "./JoinYourTeamModal";
import {
consumePendingInvitationToken,
clearPendingInvitationToken,
@@ -166,6 +168,12 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
setCloudTranscriptionMode,
} = useSettings();
const { isSignedIn, isLoaded: authLoaded, user } = useAuth();
+ // Suppressed while a deep-linked invitation is open so the two never stack.
+ const {
+ joinable,
+ dismiss: dismissJoinable,
+ markRequested,
+ } = useJoinableWorkspaces(user?.id ?? null, isSignedIn && !invitationToken);
const usage = useUsage();
const upsell = decideUpsell({
authLoaded,
@@ -922,6 +930,14 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
}}
/>
+ <JoinYourTeamModal
+ joinable={joinable}
+ domain={user?.email?.split("@")[1] ?? null}
+ onDismiss={dismissJoinable}
+ onRequested={markRequested}
+ onJoined={() => setActiveView("personal-notes")}
+ />
+
{showSearch && (
<Suspense fallback={null}>
<CommandSearch
diff --git a/src/components/InviteTeammateDialog.tsx b/src/components/InviteTeammateDialog.tsx
index 041cb5d65..e9f3b2966 100644
--- a/src/components/InviteTeammateDialog.tsx
+++ b/src/components/InviteTeammateDialog.tsx
@@ -16,8 +16,8 @@ import { cn } from "./lib/utils";
import { useWorkspaceStore } from "../stores/workspaceStore";
import { useDelayedFlag } from "../hooks/useDelayedFlag";
import { InvitationsService } from "../services/InvitationsService";
-import { CloudApiError } from "../services/cloudApi";
-import { WorkspacesService } from "../services/WorkspacesService";
+import { WorkspacesService, type SeatPreview } from "../services/WorkspacesService";
+import { formatAmount } from "../utils/formatAmount";
import { useToast } from "./ui/useToast";
interface Props {
@@ -26,7 +26,6 @@ interface Props {
workspaceId: string;
workspaceName: string;
onInvited?: () => void;
- onNavigateToBilling?: () => void;
cancelLabel?: string;
/** Team spaces the invitee joins on accept (threaded into the invitation). */
teamIds?: string[];
@@ -39,7 +38,6 @@ export default function InviteTeammateDialog({
workspaceId,
workspaceName,
onInvited,
- onNavigateToBilling,
cancelLabel,
teamIds,
initialEmail,
@@ -51,21 +49,27 @@ export default function InviteTeammateDialog({
const [submitting, setSubmitting] = useState(false);
const showSpinner = useDelayedFlag(submitting);
const [seatsUsed, setSeatsUsed] = useState<number | null>(null);
- const [seatLimitSeats, setSeatLimitSeats] = useState<number | null>(null);
+ const [seatPreview, setSeatPreview] = useState<SeatPreview | null>(null);
const workspace = useWorkspaceStore((s) => s.workspaces.find((w) => w.id === workspaceId));
const seats = workspace?.seats ?? null;
- const isOwner = workspace?.role === "owner";
+ // A subscribed workspace already at capacity bills a seat for this invite.
+ // Say so before sending rather than failing after. Both sides of the
+ // comparison come from the same preview so a stale store can't misprice it.
+ const addsBilledSeat =
+ seatPreview !== null && seatPreview.seats_used >= seatPreview.current_quantity;
useEffect(() => {
if (!open) return;
let cancelled = false;
WorkspacesService.previewSeats(workspaceId, 1)
.then((preview) => {
- if (!cancelled) setSeatsUsed(preview.seats_used);
+ if (cancelled) return;
+ setSeatPreview(preview);
+ setSeatsUsed(preview.seats_used);
})
.catch(async () => {
- // No subscription yet — fall back to the member count so the seat
- // line always renders.
+ // Free workspace — the preview needs a subscription. Fall back to the
+ // member count so the seat line still renders, with nothing to bill.
try {
const members = await WorkspacesService.listMembers(workspaceId);
if (!cancelled) setSeatsUsed(members.length);
@@ -85,7 +89,7 @@ export default function InviteTeammateDialog({
setEmail("");
setRole("member");
setSeatsUsed(null);
- setSeatLimitSeats(null);
+ setSeatPreview(null);
}
}, [open, initialEmail]);
@@ -93,7 +97,6 @@ export default function InviteTeammateDialog({
e.preventDefault();
if (!email.trim()) return;
setSubmitting(true);
- setSeatLimitSeats(null);
try {
const result = await InvitationsService.send(workspaceId, {
email: email.trim().toLowerCase(),
@@ -115,19 +118,11 @@ export default function InviteTeammateDialog({
onInvited?.();
onOpenChange(false);
} catch (error) {
- if (
- error instanceof CloudApiError &&
- (error.code === "seat_limit_reached" || error.code === "workspace_subscription_required")
- ) {
- const details = error.details as { seats?: number } | undefined;
- setSeatLimitSeats(details?.seats ?? seats ?? 0);
- } else {
- toast({
- title: t("workspaces.invite.errorTitle"),
- description: error instanceof Error ? error.message : t("common.unknownError"),
- variant: "destructive",
- });
- }
+ toast({
+ title: t("workspaces.invite.errorTitle"),
+ description: error instanceof Error ? error.message : t("common.unknownError"),
+ variant: "destructive",
+ });
} finally {
setSubmitting(false);
}
@@ -194,28 +189,12 @@ export default function InviteTeammateDialog({
</div>
</div>
- {seatLimitSeats !== null && (
- <div className="rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 flex items-center justify-between gap-3">
- <p className="text-xs text-destructive">
- {isOwner
- ? t("workspaces.invite.seatLimit", { seats: seatLimitSeats })
- : t("workspaces.invite.askOwner", { seats: seatLimitSeats })}
- </p>
- {isOwner && onNavigateToBilling && (
- <Button
- type="button"
- variant="outline"
- size="sm"
- className="shrink-0"
- onClick={() => {
- onOpenChange(false);
- onNavigateToBilling();
- }}
- >
- {t("workspaces.invite.manageSeats")}
- </Button>
- )}
- </div>
+ {addsBilledSeat && (
+ <p className="text-[11px] text-muted-foreground">
+ {t("workspaces.invite.seatCost", {
+ amount: formatAmount(seatPreview.amount_due, seatPreview.currency),
+ })}
+ </p>
)}
<DialogFooter className="pt-1">
diff --git a/src/components/JoinYourTeamModal.tsx b/src/components/JoinYourTeamModal.tsx
new file mode 100644
index 000000000..3befa09d8
--- /dev/null
+++ b/src/components/JoinYourTeamModal.tsx
@@ -0,0 +1,198 @@
+import { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { Check, Loader2 } from "lucide-react";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+ DialogFooter,
+} from "./ui/dialog";
+import { Button } from "./ui/button";
+import { useToast } from "./ui/useToast";
+import MemberAvatar from "./MemberAvatar";
+import { WorkspacesService } from "../services/WorkspacesService";
+import { afterWorkspaceJoined } from "../services/membershipActions";
+import { cn } from "./lib/utils";
+import type { JoinableWorkspace } from "../types/electron";
+
+interface Props {
+ joinable: JoinableWorkspace[];
+ /** Domain the matches were found on, for the headline. */
+ domain: string | null;
+ onDismiss: () => void;
+ onRequested: (workspaceId: string) => void;
+ onJoined?: (entry: { workspaceId: string }) => void;
+}
+
+function workspaceMonogram(name: string): string {
+ const words = name.trim().split(/\s+/).filter(Boolean);
+ const letters = words.length > 1 ? `${words[0][0]}${words[1][0]}` : name.slice(0, 2);
+ return letters.toUpperCase();
+}
+
+/**
+ * Post-signup catch for teammates who install the app and sign up directly
+ * instead of clicking the link in their invitation email — previously they
+ * landed in a personal workspace with no way back to their team.
+ */
+export default function JoinYourTeamModal({
+ joinable,
+ domain,
+ onDismiss,
+ onRequested,
+ onJoined,
+}: Props) {
+ const { t } = useTranslation();
+ const { toast } = useToast();
+ const [busyId, setBusyId] = useState<string | null>(null);
+
+ async function handleJoin(entry: JoinableWorkspace) {
+ setBusyId(entry.workspace_id);
+ try {
+ await WorkspacesService.join(entry.workspace_id);
+ await afterWorkspaceJoined();
+ toast({
+ title: t("workspaces.join.successTitle"),
+ description: t("workspaces.join.successDescription", { workspace: entry.workspace_name }),
+ });
+ onDismiss();
+ onJoined?.({ workspaceId: entry.workspace_id });
+ } catch (error) {
+ toast({
+ title: t("workspaces.join.errorTitle"),
+ description: error instanceof Error ? error.message : t("common.unknownError"),
+ variant: "destructive",
+ });
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ async function handleRequest(entry: JoinableWorkspace) {
+ setBusyId(entry.workspace_id);
+ try {
+ await WorkspacesService.requestJoin(entry.workspace_id);
+ // Flip this row to "Requested" in place rather than closing: with several
+ // matches the user may well want to ask more than one.
+ onRequested(entry.workspace_id);
+ toast({
+ title: t("workspaces.join.requestedTitle"),
+ description: t("workspaces.join.requestedDescription", {
+ workspace: entry.workspace_name,
+ }),
+ });
+ } catch (error) {
+ toast({
+ title: t("workspaces.join.requestErrorTitle"),
+ description: error instanceof Error ? error.message : t("common.unknownError"),
+ variant: "destructive",
+ });
+ } finally {
+ setBusyId(null);
+ }
+ }
+
+ const invited = joinable.some((entry) => entry.source === "invitation");
+
+ return (
+ <Dialog open={joinable.length > 0} onOpenChange={(open) => !open && onDismiss()}>
+ <DialogContent className="max-w-md">
+ <DialogHeader>
+ <DialogTitle>
+ {invited || !domain
+ ? t("workspaces.join.title")
+ : t("workspaces.join.domainTitle", { domain })}
+ </DialogTitle>
+ <DialogDescription>
+ {invited ? t("workspaces.join.invitedDescription") : t("workspaces.join.description")}
+ </DialogDescription>
+ </DialogHeader>
+
+ <div className="space-y-1.5">
+ {joinable.map((entry) => {
+ const pending = entry.request_state === "pending";
+ const busy = busyId === entry.workspace_id;
+ return (
+ <div
+ key={entry.workspace_id}
+ className="flex items-center gap-3 rounded-md border border-border/50 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 px-3 py-2.5"
+ >
+ <span className="w-8 h-8 shrink-0 rounded-md bg-primary/10 text-primary text-[11px] font-semibold flex items-center justify-center">
+ {workspaceMonogram(entry.workspace_name)}
+ </span>
+
+ <div className="min-w-0 flex-1">
+ <p className="text-xs font-medium text-foreground truncate">
+ {entry.workspace_name}
+ </p>
+ <div className="flex items-center gap-1.5 mt-1">
+ {entry.members.length > 0 && (
+ <div className="flex -space-x-1.5">
+ {entry.members.map((member) => (
+ <span
+ key={member.email}
+ className="ring-1 ring-card dark:ring-surface-2 rounded-full"
+ >
+ <MemberAvatar
+ name={member.name}
+ email={member.email}
+ image={member.image}
+ size="sm"
+ />
+ </span>
+ ))}
+ </div>
+ )}
+ <p className="text-[11px] text-muted-foreground truncate">
+ {entry.source === "invitation"
+ ? t("workspaces.join.invitedBy", {
+ inviter: entry.inviter_name || entry.inviter_email || "",
+ role: t(`settingsPage.workspace.role.${entry.role}`),
+ })
+ : t("workspaces.join.memberCount", { count: entry.member_count })}
+ </p>
+ </div>
+ </div>
+
+ {pending ? (
+ <span
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1 h-7 px-2 rounded-md",
+ "text-[11px] font-medium text-muted-foreground bg-foreground/5"
+ )}
+ >
+ <Check className="h-3 w-3" />
+ {t("workspaces.join.requested")}
+ </span>
+ ) : (
+ <Button
+ size="sm"
+ variant={entry.mode === "join" ? "default" : "outline"}
+ className="shrink-0"
+ onClick={() =>
+ void (entry.mode === "join" ? handleJoin(entry) : handleRequest(entry))
+ }
+ disabled={busyId !== null}
+ >
+ {busy && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}
+ {entry.mode === "join"
+ ? t("workspaces.join.join")
+ : t("workspaces.join.request")}
+ </Button>
+ )}
+ </div>
+ );
+ })}
+ </div>
+
+ <DialogFooter>
+ <Button variant="ghost" onClick={onDismiss} disabled={busyId !== null}>
+ {t("workspaces.join.notNow")}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 491db9390..dbd96203c 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -2479,12 +2479,7 @@ export default function SettingsPage({
);
case "workspace":
- return (
- <WorkspaceSection
- initialSubTab={initialSubTab}
- onNavigateToBilling={() => onNavigateToSection?.("plansBilling")}
- />
- );
+ return <WorkspaceSection initialSubTab={initialSubTab} />;
case "general":
return (
diff --git a/src/components/notes/CreateSpaceDialog.tsx b/src/components/notes/CreateSpaceDialog.tsx
index b4552aa49..20190fe2d 100644
--- a/src/components/notes/CreateSpaceDialog.tsx
+++ b/src/components/notes/CreateSpaceDialog.tsx
@@ -19,7 +19,6 @@ import CreateTeamDialog from "../CreateTeamDialog";
import MemberPickList from "../MemberPickList";
import { createSpace } from "../../services/spaceActions";
import { TeamsService } from "../../services/TeamsService";
-import { CloudApiError } from "../../services/cloudApi";
import { useWorkspace } from "../../hooks/useWorkspace";
import { useWorkspaceStore } from "../../stores/workspaceStore";
import { useAuth } from "../../hooks/useAuth";
@@ -40,15 +39,12 @@ interface CreateSpaceDialogProps {
onOpenChange: (open: boolean) => void;
/** Workspace preselected by the opener (e.g. a sidebar workspace row's + button). */
initialWorkspaceId?: string | null;
- /** Opens the given workspace's billing in Settings (the 402 upsell CTA). */
- onOpenWorkspaceBilling?: (workspaceId: string) => void;
}
export default function CreateSpaceDialog({
open,
onOpenChange,
initialWorkspaceId = null,
- onOpenWorkspaceBilling,
}: CreateSpaceDialogProps) {
const { t } = useTranslation();
const { toast } = useToast();
@@ -81,7 +77,6 @@ export default function CreateSpaceDialog({
const [newTeamName, setNewTeamName] = useState("");
const [createTeamOpen, setCreateTeamOpen] = useState(false);
const [isCreating, setIsCreating] = useState(false);
- const [planBlocked, setPlanBlocked] = useState(false);
const [selectedWorkspaceId, setSelectedWorkspaceId] = useState<string | null>(null);
const showSpinner = useDelayedFlag(isCreating);
@@ -161,7 +156,6 @@ export default function CreateSpaceDialog({
setNewTeamOpen(false);
setNewTeamName("");
setCreateTeamOpen(false);
- setPlanBlocked(false);
setSelectedWorkspaceId(null);
}
};
@@ -205,7 +199,6 @@ export default function CreateSpaceDialog({
setSelectedTeamIds(new Set());
setNewTeamOpen(false);
setNewTeamName("");
- setPlanBlocked(false);
};
// A space needs at least one team (existing or new) unless team loading
@@ -248,13 +241,6 @@ export default function CreateSpaceDialog({
}
handleOpenChange(false);
} catch (err) {
- // Workspace entitlement is separate from the user's personal plan, so a
- // paying user can hit this on a fresh (Free) workspace — an inline
- // explainer with a billing CTA, not an error toast.
- if (err instanceof CloudApiError && err.code === "upgrade_required") {
- setPlanBlocked(true);
- return;
- }
toast({
title: t("notes.spaces.couldNotCreate"),
description: err instanceof Error ? err.message : t("common.unknownError"),
@@ -509,30 +495,6 @@ export default function CreateSpaceDialog({
)}
</div>
- {planBlocked && workspace && (
- <div className="rounded-lg border border-border/50 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 px-4 py-6 flex items-center justify-between gap-3">
- <div className="min-w-0">
- <p className="text-xs font-medium text-foreground">
- {t("notes.spaces.planBlocked.title", { workspace: workspace.name })}
- </p>
- <p className="text-xs text-muted-foreground mt-0.5">
- {t("notes.spaces.planBlocked.description")}
- </p>
- </div>
- <Button
- variant="outline"
- size="sm"
- className="shrink-0"
- onClick={() => {
- handleOpenChange(false);
- onOpenWorkspaceBilling?.(workspace.id);
- }}
- >
- {t("notes.spaces.planBlocked.cta")}
- </Button>
- </div>
- )}
-
<DialogFooter>
<Button
variant="ghost"
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index dfe72512c..7320ea71c 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -1,12 +1,4 @@
-import {
- useState,
- useRef,
- useEffect,
- useMemo,
- useCallback,
- useSyncExternalStore,
- type ComponentProps,
-} from "react";
+import { useState, useRef, useEffect, useMemo, useCallback, type ComponentProps } from "react";
import { useTranslation } from "react-i18next";
import {
Download,
@@ -44,7 +36,6 @@ import {
} from "../../stores/noteStore";
import { NoteSharingService } from "../../services/NoteSharingService";
import { fetchSpaceRoster } from "../../hooks/useSpaceRoster";
-import { readIsSubscribed, subscribeIsSubscribed } from "../../lib/subscriptionFlag";
import { useAuth } from "../../hooks/useAuth";
import { RichTextEditor } from "../ui/RichTextEditor";
import type { Editor } from "@tiptap/react";
@@ -257,9 +248,6 @@ export default function NoteEditor({
// Persisted flag is the restart-safe truth; the live cache overlays it for
// the current session (it reflects server state before the flag persists).
const isShared = shareCache ? shareCache.share.visibility !== "private" : Boolean(note.is_shared);
- // Same gate as SyncService.canSyncSharedNotes: sharing needs a subscription.
- // An already-shared note stays manageable (unshare/revoke) after a lapse.
- const isSubscribed = useSyncExternalStore(subscribeIsSubscribed, readIsSubscribed);
const aclState: NoteAclState = shareCache
? "loaded"
: !note.cloud_id || !isSignedIn
@@ -276,8 +264,7 @@ export default function NoteEditor({
const canShare =
isSignedIn &&
(!note.cloud_id || isTeamNote || aclState === "loaded") &&
- shareCapabilities.canShare &&
- (isSubscribed || Boolean(note.is_shared));
+ shareCapabilities.canShare;
const canEditNote = shareCapabilities.canEdit;
// Re-filing is owner-only on shared personal notes (a denied folder_id
// PATCH would fork an unexpected Personal copy); team members keep
diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsx
index ba7f4b5d8..8f236dedc 100644
--- a/src/components/notes/PersonalNotesView.tsx
+++ b/src/components/notes/PersonalNotesView.tsx
@@ -54,7 +54,6 @@ import {
} from "../../stores/meetingRecordingStore";
import { useNotesOnboarding } from "../../hooks/useNotesOnboarding";
import { useTeamSpacesCapability } from "../../hooks/useTeamSpacesCapability";
-import { useWorkspaceStore } from "../../stores/workspaceStore";
import { useAuth } from "../../hooks/useAuth";
import { usePolicySnapshot, useTranscriptionContextAllowed } from "../../hooks/usePolicy";
import NotesOnboarding from "./NotesOnboarding";
@@ -757,13 +756,6 @@ export default function PersonalNotesView({
onCreateFolderAndMove={handleCreateFolderAndMove}
onNewNote={handleNewNoteIn}
onShowStructureIntro={() => setShowStructureIntro(true)}
- onUpgrade={() => onOpenSettings?.("plansBilling")}
- onOpenWorkspaceBilling={(workspaceId) => {
- // Settings' billing section shows the ACTIVE workspace, so point
- // it at the one whose plan blocked the space create first.
- useWorkspaceStore.getState().setActiveWorkspaceId(workspaceId);
- onOpenSettings?.("plansBilling");
- }}
/>
</div>
</div>
diff --git a/src/components/notes/SpacesTree.tsx b/src/components/notes/SpacesTree.tsx
index b39efac2b..012d6ec54 100644
--- a/src/components/notes/SpacesTree.tsx
+++ b/src/components/notes/SpacesTree.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useRef, useState, useSyncExternalStore } from "react";
+import { useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import {
Check,
@@ -53,7 +53,6 @@ import {
} from "../../lib/notePermissions";
import { groupTeamSpacesByWorkspace } from "../../lib/workspaceSelection";
import { localMutationErrorKey } from "../../lib/localMutationError";
-import { readIsSubscribed, subscribeIsSubscribed } from "../../lib/subscriptionFlag";
import { deleteSpace, renameSpace } from "../../services/spaceActions";
import { useSettingsStore } from "../../stores/settingsStore";
import { cn } from "../lib/utils";
@@ -159,8 +158,6 @@ interface SpacesTreeProps {
onCreateFolderAndMove: (noteId: number, folderName: string) => void;
onNewNote: (spaceId: number, folderId: number | null) => void;
onShowStructureIntro?: () => void;
- onUpgrade?: () => void;
- onOpenWorkspaceBilling?: (workspaceId: string) => void;
}
function spaceDisplayName(space: SpaceItem, t: TFn): string {
@@ -1112,8 +1109,6 @@ export default function SpacesTree({
onCreateFolderAndMove,
onNewNote,
onShowStructureIntro,
- onUpgrade,
- onOpenWorkspaceBilling,
}: SpacesTreeProps) {
const { t } = useTranslation();
const { toast, dismiss } = useToast();
@@ -1128,7 +1123,6 @@ export default function SpacesTree({
const activeContext = useActiveContext();
const activeNoteId = useActiveNoteId();
const isTreeLoading = useIsTreeLoading();
- const isSubscribed = useSyncExternalStore(subscribeIsSubscribed, readIsSubscribed);
const { isSignedIn, user } = useAuth();
const teamCapability = useTeamSpacesCapability(isSignedIn);
const { workspaces, loaded: workspacesLoaded } = useWorkspace();
@@ -2170,26 +2164,6 @@ export default function SpacesTree({
)}
</div>
)}
- {!teamCapability && isSignedIn && !isSubscribed && (
- <div role="none">
- <SectionHeader label={t("notes.spaces.teamSpaces")} className="mt-3" />
- <p className="pl-[18px] pr-2 py-1 text-xs text-foreground/40 leading-relaxed">
- {t("notes.spaces.lockedPitch")}
- </p>
- {onUpgrade && (
- <div className="pl-[18px] pr-2 pb-1">
- <Button
- variant="ghost"
- size="sm"
- onClick={onUpgrade}
- className="h-6 px-2 text-xs gap-1 text-primary/70 hover:text-primary hover:bg-primary/8"
- >
- {t("settingsPage.account.pricing.upgrade")}
- </Button>
- </div>
- )}
- </div>
- )}
</div>
<CreateSpaceDialog
@@ -2199,7 +2173,6 @@ export default function SpacesTree({
if (!open) setCreateSpaceWorkspaceId(null);
}}
initialWorkspaceId={createSpaceWorkspaceId}
- onOpenWorkspaceBilling={onOpenWorkspaceBilling}
/>
{membersSpace && (
diff --git a/src/components/settings/WorkspaceBillingCard.tsx b/src/components/settings/WorkspaceBillingCard.tsx
index f34de7892..76760ec89 100644
--- a/src/components/settings/WorkspaceBillingCard.tsx
+++ b/src/components/settings/WorkspaceBillingCard.tsx
@@ -18,17 +18,10 @@ import type { Workspace } from "../../types/electron";
interface Props {
workspace: Workspace;
- requestedAdditionalSeats?: number;
- onSeatIntentConsumed?: () => void;
onRefreshEntitlement?: () => Promise<void>;
}
-export default function WorkspaceBillingCard({
- workspace,
- requestedAdditionalSeats = 0,
- onSeatIntentConsumed,
- onRefreshEntitlement,
-}: Props) {
+export default function WorkspaceBillingCard({ workspace, onRefreshEntitlement }: Props) {
const { t } = useTranslation();
const { toast } = useToast();
const refresh = useWorkspaceStore((s) => s.refresh);
@@ -71,7 +64,6 @@ export default function WorkspaceBillingCard({
const url = await getUrl();
if (window.electronAPI?.openExternal) await window.electronAPI.openExternal(url);
else window.open(url, "_blank");
- onSeatIntentConsumed?.();
refreshOnReturn();
} catch (error) {
toast({
@@ -105,7 +97,6 @@ export default function WorkspaceBillingCard({
try {
await WorkspacesService.updateSeats(workspace.id, seatPreview.next_quantity);
setSeatPreview(null);
- onSeatIntentConsumed?.();
await refresh();
toast({
title: t("settingsPage.unifiedBilling.seatUpdated", {
@@ -233,22 +224,14 @@ export default function WorkspaceBillingCard({
<Button
onClick={() =>
void openBilling("checkout", () =>
- WorkspacesService.billingCheckout(
- workspace.id,
- "monthly",
- requestedAdditionalSeats
- )
+ WorkspacesService.billingCheckout(workspace.id, "monthly")
)
}
disabled={busy !== null}
size="sm"
>
{busy === "checkout" && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}
- {requestedAdditionalSeats > 0
- ? t("settingsPage.unifiedBilling.startWithSeats", {
- count: seatsUsed + requestedAdditionalSeats,
- })
- : t("settingsPage.workspace.billing.startSubscription")}
+ {t("settingsPage.workspace.billing.startSubscription")}
</Button>
)}
</div>
diff --git a/src/components/settings/WorkspaceBillingOverview.tsx b/src/components/settings/WorkspaceBillingOverview.tsx
index d854b3535..c0d50f3af 100644
--- a/src/components/settings/WorkspaceBillingOverview.tsx
+++ b/src/components/settings/WorkspaceBillingOverview.tsx
@@ -2,7 +2,6 @@ import React, { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useShallow } from "zustand/react/shallow";
import { useWorkspaceStore } from "../../stores/workspaceStore";
-import { clearSeatIntent, readSeatIntent, type SeatIntent } from "../../utils/billingSeatIntent";
import WorkspaceBillingCard from "./WorkspaceBillingCard";
export default function WorkspaceBillingOverview({
@@ -20,8 +19,6 @@ export default function WorkspaceBillingOverview({
refresh: s.refresh,
}))
);
- const [seatIntent, setSeatIntent] = useState<SeatIntent | null>(() => readSeatIntent());
-
useEffect(() => {
if (!loaded) void refresh();
}, [loaded, refresh]);
@@ -35,11 +32,6 @@ export default function WorkspaceBillingOverview({
});
}, [activeWorkspaceId, workspaces]);
- function consumeSeatIntent() {
- clearSeatIntent();
- setSeatIntent(null);
- }
-
if (!loaded && workspaces.length === 0) {
return (
<div className="space-y-2">
@@ -65,12 +57,6 @@ export default function WorkspaceBillingOverview({
<WorkspaceBillingCard
key={workspace.id}
workspace={workspace}
- requestedAdditionalSeats={
- seatIntent?.workspaceId === workspace.id ? seatIntent.additionalSeats : 0
- }
- onSeatIntentConsumed={
- seatIntent?.workspaceId === workspace.id ? consumeSeatIntent : undefined
- }
onRefreshEntitlement={onRefreshEntitlement}
/>
))}
diff --git a/src/components/settings/WorkspaceMembersTab.tsx b/src/components/settings/WorkspaceMembersTab.tsx
index 11754dd17..2535a9f59 100644
--- a/src/components/settings/WorkspaceMembersTab.tsx
+++ b/src/components/settings/WorkspaceMembersTab.tsx
@@ -9,7 +9,12 @@ import { useDialogs } from "../../hooks/useDialogs";
import { Button } from "../ui/button";
import { ConfirmDialog } from "../ui/dialog";
import { useToast } from "../ui/useToast";
-import type { Workspace, WorkspaceInvitation, WorkspaceMember } from "../../types/electron";
+import type {
+ Workspace,
+ WorkspaceInvitation,
+ WorkspaceJoinRequest,
+ WorkspaceMember,
+} from "../../types/electron";
import InviteTeammateDialog from "../InviteTeammateDialog";
import MemberAvatar from "../MemberAvatar";
import RoleBadge from "../RoleBadge";
@@ -24,14 +29,13 @@ import { canManageWorkspace } from "../../lib/spacePermissions";
interface Props {
workspace: Workspace;
- onNavigateToBilling: () => void;
}
function invitationDaysLeft(inv: WorkspaceInvitation): number {
return Math.ceil((new Date(inv.expires_at).getTime() - Date.now()) / 86_400_000);
}
-export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }: Props) {
+export default function WorkspaceMembersTab({ workspace }: Props) {
const { t } = useTranslation();
const { toast } = useToast();
const { confirmDialog, showConfirmDialog, hideConfirmDialog } = useDialogs();
@@ -43,13 +47,14 @@ export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }:
}))
);
const [invitations, setInvitations] = useState<WorkspaceInvitation[]>([]);
+ const [joinRequests, setJoinRequests] = useState<WorkspaceJoinRequest[]>([]);
+ const [decidingId, setDecidingId] = useState<string | null>(null);
const [inviteOpen, setInviteOpen] = useState(false);
const [resendingId, setResendingId] = useState<string | null>(null);
const [membersLoading, setMembersLoading] = useState(false);
const [membersError, setMembersError] = useState(false);
const [invitationsError, setInvitationsError] = useState(false);
const canManage = canManageWorkspace(workspace.role);
-
async function loadMembers() {
setMembersLoading(true);
setMembersError(false);
@@ -62,6 +67,40 @@ export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }:
}
}
+ async function refreshJoinRequests() {
+ try {
+ setJoinRequests(await WorkspacesService.listJoinRequests(workspace.id));
+ } catch {
+ // Requests are additive context; a failure here must not break the tab.
+ setJoinRequests([]);
+ }
+ }
+
+ async function decideJoinRequest(request: WorkspaceJoinRequest, decision: "approve" | "deny") {
+ setDecidingId(request.id);
+ try {
+ await WorkspacesService.decideJoinRequest(workspace.id, request.id, decision);
+ setJoinRequests((current) => current.filter((r) => r.id !== request.id));
+ if (decision === "approve") await loadMembers();
+ toast({
+ title:
+ decision === "approve"
+ ? t("settingsPage.workspace.joinRequests.approved", {
+ name: request.name ?? request.email,
+ })
+ : t("settingsPage.workspace.joinRequests.denied"),
+ });
+ } catch (error) {
+ toast({
+ title: t("settingsPage.workspace.joinRequests.errorTitle"),
+ description: error instanceof Error ? error.message : t("common.unknownError"),
+ variant: "destructive",
+ });
+ } finally {
+ setDecidingId(null);
+ }
+ }
+
async function refreshInvitations() {
setInvitationsError(false);
try {
@@ -75,7 +114,10 @@ export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }:
useEffect(() => {
void loadMembers();
- if (canManage) void refreshInvitations();
+ if (canManage) {
+ void refreshInvitations();
+ void refreshJoinRequests();
+ }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [workspace.id]);
@@ -292,6 +334,54 @@ export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }:
</div>
)}
+ {canManage && joinRequests.length > 0 && (
+ <div>
+ <h4 className="text-xs font-semibold text-foreground mb-2">
+ {t("settingsPage.workspace.joinRequests.title")}
+ </h4>
+ <div className="rounded-lg border border-border/50 dark:border-border-subtle/70 divide-y divide-border/30 dark:divide-border-subtle/50 bg-card/50 dark:bg-surface-2/50">
+ {joinRequests.map((request) => (
+ <div key={request.id} className="flex items-center gap-3 px-4 h-12">
+ <MemberAvatar
+ name={request.name}
+ email={request.email}
+ image={request.image}
+ size="sm"
+ />
+ <div className="flex-1 min-w-0">
+ <p className="text-xs text-foreground truncate">
+ {request.name ?? request.email}
+ </p>
+ {request.name && (
+ <p className="text-[11px] text-muted-foreground truncate">{request.email}</p>
+ )}
+ </div>
+ <div className="flex items-center gap-1.5 shrink-0">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => void decideJoinRequest(request, "deny")}
+ disabled={decidingId !== null}
+ >
+ {t("settingsPage.workspace.joinRequests.deny")}
+ </Button>
+ <Button
+ size="sm"
+ onClick={() => void decideJoinRequest(request, "approve")}
+ disabled={decidingId !== null}
+ >
+ {decidingId === request.id && (
+ <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />
+ )}
+ {t("settingsPage.workspace.joinRequests.approve")}
+ </Button>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
{canManage && invitations.length > 0 && (
<div>
<h4 className="text-xs font-semibold text-foreground mb-2">
@@ -356,7 +446,6 @@ export default function WorkspaceMembersTab({ workspace, onNavigateToBilling }:
workspaceId={workspace.id}
workspaceName={workspace.name}
onInvited={refreshInvitations}
- onNavigateToBilling={onNavigateToBilling}
/>
<ConfirmDialog
diff --git a/src/components/settings/WorkspaceSection.tsx b/src/components/settings/WorkspaceSection.tsx
index 97bd82034..000ac9205 100644
--- a/src/components/settings/WorkspaceSection.tsx
+++ b/src/components/settings/WorkspaceSection.tsx
@@ -23,7 +23,6 @@ import {
DropdownMenuSeparator,
} from "../ui/dropdown-menu";
import { cn } from "../lib/utils";
-import { storeSeatIntent } from "../../utils/billingSeatIntent";
import { canManageWorkspace } from "../../lib/spacePermissions";
import WorkspaceMembersTab from "./WorkspaceMembersTab";
import WorkspaceTeamsTab from "./WorkspaceTeamsTab";
@@ -35,10 +34,9 @@ type WorkspaceTab = (typeof SUB_TABS)[number];
interface Props {
initialSubTab?: string;
- onNavigateToBilling?: () => void;
}
-export default function WorkspaceSection({ initialSubTab, onNavigateToBilling }: Props) {
+export default function WorkspaceSection({ initialSubTab }: Props) {
const { t } = useTranslation();
const { isSignedIn } = useAuth();
const { workspaces, activeWorkspaceId, setActiveWorkspaceId, loaded, loading, error, refresh } =
@@ -60,12 +58,6 @@ export default function WorkspaceSection({ initialSubTab, onNavigateToBilling }:
const [createOpen, setCreateOpen] = useState(false);
const [inviteWorkspaceId, setInviteWorkspaceId] = useState<string | null>(null);
- function navigateToBilling(workspaceId: string) {
- setActiveWorkspaceId(workspaceId);
- storeSeatIntent(workspaceId, 1);
- onNavigateToBilling?.();
- }
-
useEffect(() => {
if (isSignedIn && !loaded) void refresh();
}, [isSignedIn, loaded, refresh]);
@@ -99,7 +91,6 @@ export default function WorkspaceSection({ initialSubTab, onNavigateToBilling }:
workspaceId={inviteWorkspace.id}
workspaceName={inviteWorkspace.name}
cancelLabel={t("common.skip")}
- onNavigateToBilling={() => navigateToBilling(inviteWorkspace.id)}
/>
)}
</>
@@ -230,12 +221,7 @@ export default function WorkspaceSection({ initialSubTab, onNavigateToBilling }:
<div className="pt-1">
{tab === "general" && <GeneralTab workspace={workspace} />}
- {tab === "members" && (
- <WorkspaceMembersTab
- workspace={workspace}
- onNavigateToBilling={() => navigateToBilling(workspace.id)}
- />
- )}
+ {tab === "members" && <WorkspaceMembersTab workspace={workspace} />}
{tab === "teams" && <WorkspaceTeamsTab workspace={workspace} />}
{tab === "developer" && canManage && <WorkspaceDeveloperTab workspace={workspace} />}
</div>
diff --git a/src/hooks/useJoinableWorkspaces.ts b/src/hooks/useJoinableWorkspaces.ts
new file mode 100644
index 000000000..ad905c0ee
--- /dev/null
+++ b/src/hooks/useJoinableWorkspaces.ts
@@ -0,0 +1,69 @@
+import { useCallback, useEffect, useState } from "react";
+import { WorkspacesService } from "../services/WorkspacesService";
+import type { JoinableWorkspace } from "../types/electron";
+
+const DISMISSED_KEY = "workspaces.joinPromptDismissed";
+
+/**
+ * Workspace ids this account has already said "not now" to, so the prompt
+ * doesn't reappear on every launch. Keyed by user so switching accounts starts
+ * clean, and stored per-workspace so a *new* invitation still prompts.
+ */
+function readDismissed(userId: string): Set<string> {
+ try {
+ const raw = localStorage.getItem(`${DISMISSED_KEY}.${userId}`);
+ return new Set(raw ? (JSON.parse(raw) as string[]) : []);
+ } catch {
+ return new Set();
+ }
+}
+
+function writeDismissed(userId: string, ids: Set<string>): void {
+ localStorage.setItem(`${DISMISSED_KEY}.${userId}`, JSON.stringify([...ids]));
+}
+
+export function useJoinableWorkspaces(userId: string | null, enabled: boolean) {
+ const [joinable, setJoinable] = useState<JoinableWorkspace[]>([]);
+
+ useEffect(() => {
+ if (!enabled || !userId) {
+ setJoinable([]);
+ return;
+ }
+ let cancelled = false;
+ // A failure here must stay silent: this is a proactive nudge, not
+ // something the user asked for.
+ WorkspacesService.listJoinable()
+ .then((entries) => {
+ if (cancelled) return;
+ const dismissed = readDismissed(userId);
+ setJoinable(entries.filter((entry) => !dismissed.has(entry.workspace_id)));
+ })
+ .catch(() => {});
+ return () => {
+ cancelled = true;
+ };
+ }, [enabled, userId]);
+
+ const dismiss = useCallback(() => {
+ if (!userId) return;
+ const dismissed = readDismissed(userId);
+ for (const entry of joinable) dismissed.add(entry.workspace_id);
+ writeDismissed(userId, dismissed);
+ setJoinable([]);
+ }, [joinable, userId]);
+
+ const markRequested = useCallback((workspaceId: string) => {
+ setJoinable((entries) =>
+ entries.map((entry) =>
+ entry.workspace_id === workspaceId ? { ...entry, request_state: "pending" } : entry
+ )
+ );
+ }, []);
+
+ // A workspace whose request is already pending is context, not a prompt —
+ // re-opening the dialog just to show "Requested" would be nagging.
+ const hasActionable = joinable.some((entry) => entry.request_state === "none");
+
+ return { joinable: hasActionable ? joinable : [], dismiss, markRequested };
+}
diff --git a/src/hooks/useTeamSpacesCapability.ts b/src/hooks/useTeamSpacesCapability.ts
index d84d9fb7a..67b754f3a 100644
--- a/src/hooks/useTeamSpacesCapability.ts
+++ b/src/hooks/useTeamSpacesCapability.ts
@@ -1,25 +1,18 @@
import { useSyncExternalStore } from "react";
import { useSpaces } from "../stores/noteStore";
import {
- readTeamSpacesCapability,
+ readTeamSpacesAvailable,
subscribeTeamSpacesCapability,
} from "../lib/teamSpacesCapability";
-/** Dev override forcing the TEAM SPACES section on without a server probe. */
-function hasTeamSpacesDevOverride(): boolean {
- return localStorage.getItem("teamSpacesDevOverride") === "true";
-}
-
/**
- * Whether the TEAM SPACES section should render: the cached server capability
- * probe (written by the spaces sync pass), the dev override, or locally known
- * team spaces.
+ * Whether the TEAM SPACES section should render. Every signed-in user gets it;
+ * the only thing that removes it is an API without the spaces endpoint, and
+ * even then locally mirrored team spaces keep it visible so their content
+ * stays reachable.
*/
export function useTeamSpacesCapability(isSignedIn: boolean): boolean {
const spaces = useSpaces();
- const capability = useSyncExternalStore(subscribeTeamSpacesCapability, readTeamSpacesCapability);
- return (
- isSignedIn &&
- (hasTeamSpacesDevOverride() || capability || spaces.some((space) => space.kind === "team"))
- );
+ const available = useSyncExternalStore(subscribeTeamSpacesCapability, readTeamSpacesAvailable);
+ return isSignedIn && (available || spaces.some((space) => space.kind === "team"));
}
diff --git a/src/lib/teamSpacesCapability.ts b/src/lib/teamSpacesCapability.ts
index 67bb19de1..f1ee82ea3 100644
--- a/src/lib/teamSpacesCapability.ts
+++ b/src/lib/teamSpacesCapability.ts
@@ -7,3 +7,13 @@ export const readTeamSpacesCapability = flag.read;
export const writeTeamSpacesCapability = flag.write;
export const clearTeamSpacesCapability = flag.clear;
export const subscribeTeamSpacesCapability = flag.subscribe;
+
+/**
+ * UI-side read: unprobed counts as available. Team spaces are the default for
+ * every signed-in user, so the section must not blink out of existence while
+ * the first sync pass runs — only a confirmed 404 (endpoint not deployed)
+ * takes it away. Sync keeps using the strict read above: guessing there would
+ * attach workspace scope to pushes an older API cannot accept.
+ */
+export const readTeamSpacesAvailable = (): boolean =>
+ localStorage.getItem("teamSpacesCapability") !== "false";
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 6e4f5fb06..e05cd1ebd 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -1309,6 +1309,14 @@
"description": "{{name}} wird Inhaber von {{workspace}}. Ihre Rolle ändert sich zu Administrator und nur der neue Inhaber kann das Eigentum zurückübertragen."
}
},
+ "joinRequests": {
+ "title": "Beitrittsanfragen",
+ "approve": "Annehmen",
+ "deny": "Ablehnen",
+ "approved": "{{name}} ist dem Workspace beigetreten",
+ "denied": "Anfrage abgelehnt",
+ "errorTitle": "Anfrage konnte nicht aktualisiert werden"
+ },
"teams": {
"title": "Teams",
"description": "Gruppen von Workspace-Mitgliedern, die Zugriff auf Team-Spaces gewähren.",
@@ -1438,8 +1446,6 @@
"nonBillableSeat": "Nur Admin-Zugriff · kein kostenpflichtiger Platz",
"managedBy": "Die Abrechnung wird von {{owner}} verwaltet.",
"addSeat": "Platz hinzufügen",
- "startWithSeats_one": "Business mit {{count}} Platz starten",
- "startWithSeats_other": "Business mit {{count}} Plätzen starten",
"seatUpdated_one": "Workspace-Kapazität auf {{count}} Platz aktualisiert",
"seatUpdated_other": "Workspace-Kapazität auf {{count}} Plätze aktualisiert",
"seatUpdateFailed": "Workspace-Plätze konnten nicht aktualisiert werden",
@@ -2376,9 +2382,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Rolle",
"seatUsage": "{{used}} von {{seats}} Plätzen belegt",
- "seatLimit": "Alle {{seats}} Plätze sind belegt.",
- "askOwner": "Alle {{seats}} Plätze sind belegt. Bitten Sie den Workspace-Inhaber, Plätze hinzuzufügen.",
- "manageSeats": "Plätze verwalten",
+ "seatCost": "Fügt deinem Tarif einen Platz hinzu · {{amount}} werden jetzt berechnet.",
"submit": "Einladung senden",
"submitting": "Sende…",
"sentTitle": "Einladung gesendet",
@@ -2395,6 +2399,25 @@
"member": "Nutzt den Workspace"
}
},
+ "join": {
+ "title": "Team beitreten",
+ "domainTitle": "Dein Team ist schon auf OpenWhispr",
+ "description": "In diesen Workspaces ist jemand aus deiner E-Mail-Domain.",
+ "invitedDescription": "Du wurdest zu einem Workspace eingeladen.",
+ "invitedBy": "Eingeladen von {{inviter}} als {{role}}",
+ "memberCount_one": "{{count}} Mitglied",
+ "memberCount_other": "{{count}} Mitglieder",
+ "join": "Beitreten",
+ "requestErrorTitle": "Anfrage konnte nicht gesendet werden",
+ "requestedDescription": "Ein Admin von {{workspace}} sieht sie sich an.",
+ "requestedTitle": "Anfrage gesendet",
+ "requested": "Angefragt",
+ "request": "Zutritt anfragen",
+ "notNow": "Jetzt nicht",
+ "successTitle": "Beigetreten",
+ "successDescription": "Du bist jetzt Mitglied von {{workspace}}.",
+ "errorTitle": "Beitritt fehlgeschlagen"
+ },
"accept": {
"title": "Workspace beitreten",
"description": "{{inviter}} hat Sie eingeladen, {{workspace}} als {{role}} beizutreten.",
@@ -2563,12 +2586,6 @@
"undo": "Rückgängig",
"emptySpace": "Noch keine Notizen. Notizen hier sind für alle in {{space}} sichtbar.",
"emptyTeamHint": "Mit Ihnen geteilte Bereiche erscheinen hier.",
- "lockedPitch": "Erstellen Sie gemeinsame Bereiche, in denen die Notizen Ihres Teams synchron bleiben.",
- "planBlocked": {
- "title": "{{workspace}} nutzt den Free-Tarif",
- "description": "Workspaces haben ein eigenes Abonnement, getrennt von Ihrem persönlichen Tarif. Team-Bereiche erfordern einen kostenpflichtigen Workspace-Tarif.",
- "cta": "Workspace-Abrechnung anzeigen"
- },
"noteCount_one": "{{count}} Notiz",
"noteCount_other": "{{count}} Notizen",
"accessRevoked": "Du hast keinen Zugriff mehr auf {{space}}",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index c6198b4d8..edbe7f79b 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -1309,6 +1309,14 @@
"description": "{{name}} becomes the owner of {{workspace}}. Your role changes to admin and only the new owner can transfer it back."
}
},
+ "joinRequests": {
+ "title": "Requests to join",
+ "approve": "Approve",
+ "deny": "Deny",
+ "approved": "{{name}} joined the workspace",
+ "denied": "Request denied",
+ "errorTitle": "Could not update the request"
+ },
"teams": {
"title": "Teams",
"description": "Groups of workspace members that grant access to team spaces.",
@@ -1438,8 +1446,6 @@
"nonBillableSeat": "Admin-only access · no paid seat",
"managedBy": "Billing is managed by {{owner}}.",
"addSeat": "Add seat",
- "startWithSeats_one": "Start Business with {{count}} seat",
- "startWithSeats_other": "Start Business with {{count}} seats",
"seatUpdated_one": "Workspace capacity updated to {{count}} seat",
"seatUpdated_other": "Workspace capacity updated to {{count}} seats",
"seatUpdateFailed": "Couldn't update workspace seats",
@@ -2376,9 +2382,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Role",
"seatUsage": "Using {{used}} of {{seats}} seats",
- "seatLimit": "All {{seats}} seats are in use.",
- "askOwner": "All {{seats}} seats are in use. Ask the workspace owner to add seats.",
- "manageSeats": "Manage seats",
+ "seatCost": "Adds a seat to your plan · {{amount}} charged now.",
"submit": "Send invite",
"submitting": "Sending…",
"sentTitle": "Invite sent",
@@ -2395,6 +2399,25 @@
"member": "Uses the workspace"
}
},
+ "join": {
+ "title": "Join your team",
+ "domainTitle": "Your team is on OpenWhispr",
+ "description": "These workspaces have someone from your email domain.",
+ "invitedDescription": "You've been invited to a workspace.",
+ "invitedBy": "Invited by {{inviter}} as {{role}}",
+ "memberCount_one": "{{count}} member",
+ "memberCount_other": "{{count}} members",
+ "join": "Join",
+ "requestErrorTitle": "Could not send the request",
+ "requestedDescription": "An admin of {{workspace}} will review it.",
+ "requestedTitle": "Request sent",
+ "requested": "Requested",
+ "request": "Ask to join",
+ "notNow": "Not now",
+ "successTitle": "Joined",
+ "successDescription": "You're now a member of {{workspace}}.",
+ "errorTitle": "Could not join"
+ },
"accept": {
"title": "Join workspace",
"description": "{{inviter}} invited you to join {{workspace}} as a {{role}}.",
@@ -2563,12 +2586,6 @@
"undo": "Undo",
"emptySpace": "No notes yet. Notes here are visible to everyone in {{space}}.",
"emptyTeamHint": "Spaces shared with you will appear here.",
- "lockedPitch": "Create shared spaces where your team's notes stay in sync.",
- "planBlocked": {
- "title": "{{workspace}} is on the Free plan",
- "description": "Workspaces have their own subscription, separate from your personal plan. Team spaces need a paid workspace plan.",
- "cta": "View workspace billing"
- },
"noteCount_one": "{{count}} note",
"noteCount_other": "{{count}} notes",
"accessRevoked": "You no longer have access to {{space}}",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 5db2d9320..483c1fe2b 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -1208,8 +1208,6 @@
"nonBillableSeat": "Acceso solo de administrador · sin asiento de pago",
"managedBy": "La facturación la gestiona {{owner}}.",
"addSeat": "Añadir asiento",
- "startWithSeats_one": "Empezar Business con {{count}} asiento",
- "startWithSeats_other": "Empezar Business con {{count}} asientos",
"seatUpdated_one": "Capacidad del espacio de trabajo actualizada a {{count}} asiento",
"seatUpdated_other": "Capacidad del espacio de trabajo actualizada a {{count}} asientos",
"seatUpdateFailed": "No se pudieron actualizar los asientos del espacio de trabajo",
@@ -2038,6 +2036,14 @@
"description": "{{name}} pasa a ser el propietario de {{workspace}}. Tu rol cambia a administrador y solo el nuevo propietario puede transferirla de vuelta."
}
},
+ "joinRequests": {
+ "title": "Solicitudes de acceso",
+ "approve": "Aprobar",
+ "deny": "Rechazar",
+ "approved": "{{name}} se unió al espacio de trabajo",
+ "denied": "Solicitud rechazada",
+ "errorTitle": "No se pudo actualizar la solicitud"
+ },
"teams": {
"title": "Equipos",
"description": "Grupos de miembros del workspace que conceden acceso a espacios de equipo.",
@@ -2420,12 +2426,6 @@
"undo": "Deshacer",
"emptySpace": "Aún no hay notas. Las notas aquí son visibles para todos en {{space}}.",
"emptyTeamHint": "Los espacios compartidos contigo aparecerán aquí.",
- "lockedPitch": "Crea espacios compartidos donde las notas de tu equipo se mantienen sincronizadas.",
- "planBlocked": {
- "title": "{{workspace}} está en el plan Free",
- "description": "Los espacios de trabajo tienen su propia suscripción, separada de tu plan personal. Los espacios de equipo requieren un plan de pago del espacio de trabajo.",
- "cta": "Ver facturación del espacio de trabajo"
- },
"noteCount_one": "{{count}} nota",
"noteCount_other": "{{count}} notas",
"accessRevoked": "Ya no tienes acceso a {{space}}",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Rol",
"seatUsage": "Usando {{used}} de {{seats}} asientos",
- "seatLimit": "Todos los {{seats}} asientos están en uso.",
- "askOwner": "Todos los {{seats}} asientos están en uso. Pide al propietario del espacio de trabajo que añada asientos.",
- "manageSeats": "Administrar asientos",
+ "seatCost": "Añade un puesto a tu plan · se cobrarán {{amount}} ahora.",
"submit": "Enviar invitación",
"submitting": "Enviando…",
"sentTitle": "Invitación enviada",
@@ -3405,6 +3403,25 @@
"member": "Usa el espacio de trabajo"
}
},
+ "join": {
+ "title": "Únete a tu equipo",
+ "domainTitle": "Tu equipo ya está en OpenWhispr",
+ "description": "Estos espacios de trabajo tienen a alguien de tu dominio de correo.",
+ "invitedDescription": "Te han invitado a un espacio de trabajo.",
+ "invitedBy": "Invitado por {{inviter}} como {{role}}",
+ "memberCount_one": "{{count}} miembro",
+ "memberCount_other": "{{count}} miembros",
+ "join": "Unirse",
+ "requestErrorTitle": "No se pudo enviar la solicitud",
+ "requestedDescription": "Un administrador de {{workspace}} la revisará.",
+ "requestedTitle": "Solicitud enviada",
+ "requested": "Solicitado",
+ "request": "Pedir acceso",
+ "notNow": "Ahora no",
+ "successTitle": "Te uniste",
+ "successDescription": "Ya eres miembro de {{workspace}}.",
+ "errorTitle": "No se pudo unir"
+ },
"accept": {
"title": "Unirse al espacio de trabajo",
"description": "{{inviter}} te invitó a unirte a {{workspace}} como {{role}}.",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 87287370e..00c0a38a8 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -1309,6 +1309,14 @@
"description": "{{name}} devient propriétaire de {{workspace}}. Votre rôle passe à administrateur et seul le nouveau propriétaire pourra la retransférer."
}
},
+ "joinRequests": {
+ "title": "Demandes d'accès",
+ "approve": "Approuver",
+ "deny": "Refuser",
+ "approved": "{{name}} a rejoint l'espace de travail",
+ "denied": "Demande refusée",
+ "errorTitle": "Impossible de mettre à jour la demande"
+ },
"teams": {
"title": "Équipes",
"description": "Groupes de membres du workspace qui donnent accès aux espaces d'équipe.",
@@ -1438,8 +1446,6 @@
"nonBillableSeat": "Accès administrateur uniquement · aucun siège payant",
"managedBy": "La facturation est gérée par {{owner}}.",
"addSeat": "Ajouter un siège",
- "startWithSeats_one": "Démarrer Business avec {{count}} siège",
- "startWithSeats_other": "Démarrer Business avec {{count}} sièges",
"seatUpdated_one": "Capacité de l'espace de travail mise à jour : {{count}} siège",
"seatUpdated_other": "Capacité de l'espace de travail mise à jour : {{count}} sièges",
"seatUpdateFailed": "Impossible de mettre à jour les sièges de l'espace de travail",
@@ -2376,9 +2382,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Rôle",
"seatUsage": "{{used}} sur {{seats}} sièges utilisés",
- "seatLimit": "Les {{seats}} sièges sont tous utilisés.",
- "askOwner": "Les {{seats}} sièges sont tous utilisés. Demandez au propriétaire de l'espace de travail d'ajouter des sièges.",
- "manageSeats": "Gérer les sièges",
+ "seatCost": "Ajoute un siège à votre offre · {{amount}} facturés maintenant.",
"submit": "Envoyer l'invitation",
"submitting": "Envoi…",
"sentTitle": "Invitation envoyée",
@@ -2395,6 +2399,25 @@
"member": "Utilise l'espace de travail"
}
},
+ "join": {
+ "title": "Rejoignez votre équipe",
+ "domainTitle": "Votre équipe est déjà sur OpenWhispr",
+ "description": "Ces espaces de travail comptent quelqu'un de votre domaine e-mail.",
+ "invitedDescription": "Vous avez été invité à un espace de travail.",
+ "invitedBy": "Invité par {{inviter}} en tant que {{role}}",
+ "memberCount_one": "{{count}} membre",
+ "memberCount_other": "{{count}} membres",
+ "join": "Rejoindre",
+ "requestErrorTitle": "Impossible d'envoyer la demande",
+ "requestedDescription": "Un administrateur de {{workspace}} l'examinera.",
+ "requestedTitle": "Demande envoyée",
+ "requested": "Demandé",
+ "request": "Demander l'accès",
+ "notNow": "Pas maintenant",
+ "successTitle": "Vous avez rejoint",
+ "successDescription": "Vous êtes désormais membre de {{workspace}}.",
+ "errorTitle": "Impossible de rejoindre"
+ },
"accept": {
"title": "Rejoindre l'espace",
"description": "{{inviter}} vous a invité à rejoindre {{workspace}} en tant que {{role}}.",
@@ -2563,12 +2586,6 @@
"undo": "Annuler",
"emptySpace": "Aucune note pour le moment. Les notes ici sont visibles par tous les membres de {{space}}.",
"emptyTeamHint": "Les espaces partagés avec vous apparaîtront ici.",
- "lockedPitch": "Créez des espaces partagés où les notes de votre équipe restent synchronisées.",
- "planBlocked": {
- "title": "{{workspace}} est sur le forfait Free",
- "description": "Les espaces de travail ont leur propre abonnement, distinct de votre forfait personnel. Les espaces d'équipe nécessitent un forfait payant pour l'espace de travail.",
- "cta": "Voir la facturation de l'espace de travail"
- },
"noteCount_one": "{{count}} note",
"noteCount_other": "{{count}} notes",
"accessRevoked": "Vous n'avez plus accès à {{space}}",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 3b1086773..fc539c91d 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -1160,8 +1160,6 @@
"nonBillableSeat": "Accesso solo amministratore · nessun posto a pagamento",
"managedBy": "La fatturazione è gestita da {{owner}}.",
"addSeat": "Aggiungi posto",
- "startWithSeats_one": "Avvia Business con {{count}} posto",
- "startWithSeats_other": "Avvia Business con {{count}} posti",
"seatUpdated_one": "Capacità dell'area di lavoro aggiornata a {{count}} posto",
"seatUpdated_other": "Capacità dell'area di lavoro aggiornata a {{count}} posti",
"seatUpdateFailed": "Impossibile aggiornare i posti dell'area di lavoro",
@@ -1990,6 +1988,14 @@
"description": "{{name}} diventa il proprietario di {{workspace}}. Il tuo ruolo passa ad amministratore e solo il nuovo proprietario potrà ritrasferirla."
}
},
+ "joinRequests": {
+ "title": "Richieste di accesso",
+ "approve": "Approva",
+ "deny": "Rifiuta",
+ "approved": "{{name}} si è unito al workspace",
+ "denied": "Richiesta rifiutata",
+ "errorTitle": "Impossibile aggiornare la richiesta"
+ },
"teams": {
"title": "Team",
"description": "Gruppi di membri del workspace che concedono l'accesso agli spazi di team.",
@@ -2372,12 +2378,6 @@
"undo": "Annulla",
"emptySpace": "Ancora nessuna nota. Le note qui sono visibili a tutti in {{space}}.",
"emptyTeamHint": "Gli spazi condivisi con te appariranno qui.",
- "lockedPitch": "Crea spazi condivisi dove le note del tuo team restano sincronizzate.",
- "planBlocked": {
- "title": "{{workspace}} è sul piano Free",
- "description": "Le aree di lavoro hanno un abbonamento proprio, separato dal tuo piano personale. Gli spazi del team richiedono un piano a pagamento dell'area di lavoro.",
- "cta": "Vedi fatturazione dell'area di lavoro"
- },
"noteCount_one": "{{count}} nota",
"noteCount_other": "{{count}} note",
"accessRevoked": "Non hai più accesso a {{space}}",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Ruolo",
"seatUsage": "{{used}} di {{seats}} posti in uso",
- "seatLimit": "Tutti i {{seats}} posti sono in uso.",
- "askOwner": "Tutti i {{seats}} posti sono in uso. Chiedi al proprietario dell'area di lavoro di aggiungere posti.",
- "manageSeats": "Gestisci posti",
+ "seatCost": "Aggiunge un posto al tuo piano · {{amount}} addebitati ora.",
"submit": "Invia invito",
"submitting": "Invio…",
"sentTitle": "Invito inviato",
@@ -3405,6 +3403,25 @@
"member": "Utilizza l'area di lavoro"
}
},
+ "join": {
+ "title": "Unisciti al tuo team",
+ "domainTitle": "Il tuo team è già su OpenWhispr",
+ "description": "In questi workspace c'è qualcuno del dominio della tua email.",
+ "invitedDescription": "Sei stato invitato a un workspace.",
+ "invitedBy": "Invitato da {{inviter}} come {{role}}",
+ "memberCount_one": "{{count}} membro",
+ "memberCount_other": "{{count}} membri",
+ "join": "Unisciti",
+ "requestErrorTitle": "Impossibile inviare la richiesta",
+ "requestedDescription": "Un amministratore di {{workspace}} la esaminerà.",
+ "requestedTitle": "Richiesta inviata",
+ "requested": "Richiesto",
+ "request": "Chiedi l'accesso",
+ "notNow": "Non ora",
+ "successTitle": "Ti sei unito",
+ "successDescription": "Ora sei un membro di {{workspace}}.",
+ "errorTitle": "Impossibile unirsi"
+ },
"accept": {
"title": "Unisciti all'area di lavoro",
"description": "{{inviter}} ti ha invitato a unirti a {{workspace}} come {{role}}.",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 7afc611ea..db37ac2b0 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -1160,8 +1160,6 @@
"nonBillableSeat": "管理者専用アクセス · 有料シートなし",
"managedBy": "請求は {{owner}} が管理しています。",
"addSeat": "シートを追加",
- "startWithSeats_one": "{{count}} シートで Business を開始",
- "startWithSeats_other": "{{count}} シートで Business を開始",
"seatUpdated_one": "ワークスペースの容量を {{count}} シートに更新しました",
"seatUpdated_other": "ワークスペースの容量を {{count}} シートに更新しました",
"seatUpdateFailed": "ワークスペースのシートを更新できませんでした",
@@ -1990,6 +1988,14 @@
"description": "{{name}} が {{workspace}} のオーナーになります。あなたの役割は管理者に変わり、元に戻せるのは新しいオーナーのみです。"
}
},
+ "joinRequests": {
+ "title": "参加リクエスト",
+ "approve": "承認",
+ "deny": "却下",
+ "approved": "{{name}} がワークスペースに参加しました",
+ "denied": "リクエストを却下しました",
+ "errorTitle": "リクエストを更新できませんでした"
+ },
"teams": {
"title": "チーム",
"description": "チームスペースへのアクセスを付与するワークスペースメンバーのグループ。",
@@ -2300,12 +2306,6 @@
"undo": "元に戻す",
"emptySpace": "まだノートがありません。ここのノートは{{space}}の全員に表示されます。",
"emptyTeamHint": "共有されたスペースはここに表示されます。",
- "lockedPitch": "チームのノートが同期される共有スペースを作成しましょう。",
- "planBlocked": {
- "title": "{{workspace}} は Free プランです",
- "description": "ワークスペースには個人プランとは別の独自のサブスクリプションがあります。チームスペースにはワークスペースの有料プランが必要です。",
- "cta": "ワークスペースの請求を見る"
- },
"noteCount_one": "{{count}} 件のノート",
"noteCount_other": "{{count}} 件のノート",
"accessRevoked": "{{space}} へのアクセス権がなくなりました",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "役割",
"seatUsage": "{{seats}} シート中 {{used}} シートを使用中",
- "seatLimit": "{{seats}} シートすべてが使用中です。",
- "askOwner": "{{seats}} シートすべてが使用中です。シートの追加はワークスペースのオーナーにご依頼ください。",
- "manageSeats": "シートを管理",
+ "seatCost": "プランに 1 席追加されます · 今すぐ {{amount}} が請求されます。",
"submit": "招待を送信",
"submitting": "送信中…",
"sentTitle": "招待を送信しました",
@@ -3405,6 +3403,24 @@
"member": "ワークスペースを利用できます"
}
},
+ "join": {
+ "title": "チームに参加",
+ "domainTitle": "あなたのチームはすでに OpenWhispr にいます",
+ "description": "これらのワークスペースに、あなたと同じメールドメインのメンバーがいます。",
+ "invitedDescription": "ワークスペースに招待されています。",
+ "invitedBy": "{{inviter}} が {{role}} として招待しました",
+ "memberCount_other": "メンバー {{count}} 人",
+ "join": "参加",
+ "requestErrorTitle": "リクエストを送信できませんでした",
+ "requestedDescription": "{{workspace}} の管理者が確認します。",
+ "requestedTitle": "リクエストを送信しました",
+ "requested": "リクエスト済み",
+ "request": "参加をリクエスト",
+ "notNow": "後で",
+ "successTitle": "参加しました",
+ "successDescription": "{{workspace}} のメンバーになりました。",
+ "errorTitle": "参加できませんでした"
+ },
"accept": {
"title": "ワークスペースに参加",
"description": "{{inviter}} さんから、{{workspace}} に{{role}}として参加するよう招待されています。",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 993a28801..757c78ed4 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -1139,8 +1139,6 @@
"nonBillableSeat": "Acesso somente de administrador · sem assento pago",
"managedBy": "A cobrança é gerenciada por {{owner}}.",
"addSeat": "Adicionar assento",
- "startWithSeats_one": "Iniciar o Business com {{count}} assento",
- "startWithSeats_other": "Iniciar o Business com {{count}} assentos",
"seatUpdated_one": "Capacidade do workspace atualizada para {{count}} assento",
"seatUpdated_other": "Capacidade do workspace atualizada para {{count}} assentos",
"seatUpdateFailed": "Não foi possível atualizar os assentos do workspace",
@@ -1969,6 +1967,14 @@
"description": "{{name}} se torna o proprietário de {{workspace}}. Sua função muda para administrador e apenas o novo proprietário pode transferi-la de volta."
}
},
+ "joinRequests": {
+ "title": "Pedidos de acesso",
+ "approve": "Aprovar",
+ "deny": "Recusar",
+ "approved": "{{name}} entrou no workspace",
+ "denied": "Pedido recusado",
+ "errorTitle": "Não foi possível atualizar o pedido"
+ },
"teams": {
"title": "Equipes",
"description": "Grupos de membros do workspace que concedem acesso a espaços de equipe.",
@@ -2372,12 +2378,6 @@
"undo": "Desfazer",
"emptySpace": "Nenhuma nota ainda. As notas aqui são visíveis para todos em {{space}}.",
"emptyTeamHint": "Os espaços compartilhados com você aparecerão aqui.",
- "lockedPitch": "Crie espaços compartilhados onde as notas da sua equipe ficam sincronizadas.",
- "planBlocked": {
- "title": "{{workspace}} está no plano Free",
- "description": "Os espaços de trabalho têm sua própria assinatura, separada do seu plano pessoal. Os espaços de equipe exigem um plano pago do espaço de trabalho.",
- "cta": "Ver cobrança do espaço de trabalho"
- },
"noteCount_one": "{{count}} nota",
"noteCount_other": "{{count}} notas",
"accessRevoked": "Você não tem mais acesso a {{space}}",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Função",
"seatUsage": "Usando {{used}} de {{seats}} assentos",
- "seatLimit": "Todos os {{seats}} assentos estão em uso.",
- "askOwner": "Todos os {{seats}} assentos estão em uso. Peça ao proprietário do espaço de trabalho para adicionar assentos.",
- "manageSeats": "Gerenciar assentos",
+ "seatCost": "Adiciona um assento ao seu plano · {{amount}} cobrados agora.",
"submit": "Enviar convite",
"submitting": "Enviando…",
"sentTitle": "Convite enviado",
@@ -3405,6 +3403,25 @@
"member": "Usa o espaço de trabalho"
}
},
+ "join": {
+ "title": "Entre na sua equipe",
+ "domainTitle": "Sua equipe já está no OpenWhispr",
+ "description": "Estes workspaces têm alguém do domínio do seu e-mail.",
+ "invitedDescription": "Você foi convidado para um workspace.",
+ "invitedBy": "Convidado por {{inviter}} como {{role}}",
+ "memberCount_one": "{{count}} membro",
+ "memberCount_other": "{{count}} membros",
+ "join": "Entrar",
+ "requestErrorTitle": "Não foi possível enviar o pedido",
+ "requestedDescription": "Um administrador de {{workspace}} vai analisar.",
+ "requestedTitle": "Pedido enviado",
+ "requested": "Solicitado",
+ "request": "Pedir acesso",
+ "notNow": "Agora não",
+ "successTitle": "Você entrou",
+ "successDescription": "Agora você é membro de {{workspace}}.",
+ "errorTitle": "Não foi possível entrar"
+ },
"accept": {
"title": "Entrar no espaço de trabalho",
"description": "{{inviter}} convidou você para entrar em {{workspace}} como {{role}}.",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index a301b2a95..62a76a2d5 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -1160,10 +1160,6 @@
"nonBillableSeat": "Доступ только для администратора · без платного места",
"managedBy": "Оплатой управляет {{owner}}.",
"addSeat": "Добавить место",
- "startWithSeats_one": "Начать Business с {{count}} местом",
- "startWithSeats_few": "Начать Business с {{count}} местами",
- "startWithSeats_many": "Начать Business с {{count}} местами",
- "startWithSeats_other": "Начать Business с {{count}} местами",
"seatUpdated_one": "Вместимость рабочего пространства обновлена до {{count}} места",
"seatUpdated_few": "Вместимость рабочего пространства обновлена до {{count}} мест",
"seatUpdated_many": "Вместимость рабочего пространства обновлена до {{count}} мест",
@@ -1998,6 +1994,14 @@
"description": "{{name}} станет владельцем {{workspace}}. Ваша роль изменится на администратора, и вернуть владение сможет только новый владелец."
}
},
+ "joinRequests": {
+ "title": "Запросы на вступление",
+ "approve": "Принять",
+ "deny": "Отклонить",
+ "approved": "{{name}} присоединился к рабочему пространству",
+ "denied": "Запрос отклонён",
+ "errorTitle": "Не удалось обновить запрос"
+ },
"teams": {
"title": "Команды",
"description": "Группы участников рабочего пространства, дающие доступ к командным пространствам.",
@@ -2388,12 +2392,6 @@
"undo": "Отменить",
"emptySpace": "Пока нет заметок. Заметки здесь видны всем в {{space}}.",
"emptyTeamHint": "Пространства, которыми с вами поделились, появятся здесь.",
- "lockedPitch": "Создавайте общие пространства, где заметки вашей команды остаются синхронизированными.",
- "planBlocked": {
- "title": "{{workspace}} использует тариф Free",
- "description": "У рабочих пространств собственная подписка, отдельная от вашего личного тарифа. Командные пространства требуют платного тарифа рабочего пространства.",
- "cta": "Открыть оплату рабочего пространства"
- },
"noteCount_one": "{{count}} заметка",
"noteCount_few": "{{count}} заметки",
"noteCount_many": "{{count}} заметок",
@@ -3416,9 +3414,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "Роль",
"seatUsage": "Занято {{used}} из {{seats}} мест",
- "seatLimit": "Все {{seats}} мест заняты.",
- "askOwner": "Все {{seats}} мест заняты. Попросите владельца рабочего пространства добавить места.",
- "manageSeats": "Управлять местами",
+ "seatCost": "Добавляет место в тариф · сейчас спишется {{amount}}.",
"submit": "Отправить приглашение",
"submitting": "Отправка…",
"sentTitle": "Приглашение отправлено",
@@ -3435,6 +3431,27 @@
"member": "Пользуется рабочим пространством"
}
},
+ "join": {
+ "title": "Присоединяйтесь к команде",
+ "domainTitle": "Ваша команда уже в OpenWhispr",
+ "description": "В этих рабочих пространствах есть кто-то с вашего домена почты.",
+ "invitedDescription": "Вас пригласили в рабочее пространство.",
+ "invitedBy": "Пригласил {{inviter}}, роль: {{role}}",
+ "memberCount_one": "{{count}} участник",
+ "memberCount_few": "{{count}} участника",
+ "memberCount_many": "{{count}} участников",
+ "memberCount_other": "{{count}} участников",
+ "join": "Присоединиться",
+ "requestErrorTitle": "Не удалось отправить запрос",
+ "requestedDescription": "Администратор {{workspace}} его рассмотрит.",
+ "requestedTitle": "Запрос отправлен",
+ "requested": "Запрошено",
+ "request": "Запросить доступ",
+ "notNow": "Не сейчас",
+ "successTitle": "Вы присоединились",
+ "successDescription": "Теперь вы участник {{workspace}}.",
+ "errorTitle": "Не удалось присоединиться"
+ },
"accept": {
"title": "Присоединиться к рабочему пространству",
"description": "{{inviter}} приглашает вас в {{workspace}} с ролью «{{role}}».",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 981ca3140..e8fa48101 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -1160,8 +1160,6 @@
"nonBillableSeat": "仅管理员访问 · 无付费席位",
"managedBy": "账单由 {{owner}} 管理。",
"addSeat": "添加席位",
- "startWithSeats_one": "以 {{count}} 个席位开始 Business",
- "startWithSeats_other": "以 {{count}} 个席位开始 Business",
"seatUpdated_one": "工作区容量已更新为 {{count}} 个席位",
"seatUpdated_other": "工作区容量已更新为 {{count}} 个席位",
"seatUpdateFailed": "无法更新工作区席位",
@@ -1990,6 +1988,14 @@
"description": "{{name}} 将成为 {{workspace}} 的所有者。你的角色将变为管理员,只有新所有者才能转回所有权。"
}
},
+ "joinRequests": {
+ "title": "加入申请",
+ "approve": "批准",
+ "deny": "拒绝",
+ "approved": "{{name}} 已加入工作区",
+ "denied": "已拒绝申请",
+ "errorTitle": "无法更新申请"
+ },
"teams": {
"title": "团队",
"description": "授予团队空间访问权限的工作区成员分组。",
@@ -2372,12 +2378,6 @@
"undo": "撤销",
"emptySpace": "还没有笔记。这里的笔记对 {{space}} 中的所有人可见。",
"emptyTeamHint": "与你共享的空间将显示在这里。",
- "lockedPitch": "创建共享空间,让团队笔记保持同步。",
- "planBlocked": {
- "title": "{{workspace}} 目前是 Free 方案",
- "description": "工作区有自己的订阅,与你的个人方案相互独立。团队空间需要工作区的付费方案。",
- "cta": "查看工作区账单"
- },
"noteCount_one": "{{count}} 条笔记",
"noteCount_other": "{{count}} 条笔记",
"accessRevoked": "你已无法访问 {{space}}",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "角色",
"seatUsage": "已使用 {{used}}/{{seats}} 个席位",
- "seatLimit": "全部 {{seats}} 个席位均已使用。",
- "askOwner": "全部 {{seats}} 个席位均已使用。请联系工作区所有者添加席位。",
- "manageSeats": "管理席位",
+ "seatCost": "将为你的方案增加一个席位 · 现在收取 {{amount}}。",
"submit": "发送邀请",
"submitting": "发送中…",
"sentTitle": "邀请已发送",
@@ -3405,6 +3403,24 @@
"member": "使用工作区"
}
},
+ "join": {
+ "title": "加入你的团队",
+ "domainTitle": "你的团队已在 OpenWhispr",
+ "description": "这些工作区中有与你相同邮箱域名的成员。",
+ "invitedDescription": "有人邀请你加入一个工作区。",
+ "invitedBy": "{{inviter}} 邀请你担任{{role}}",
+ "memberCount_other": "{{count}} 位成员",
+ "join": "加入",
+ "requestErrorTitle": "无法发送申请",
+ "requestedDescription": "{{workspace}} 的管理员会进行审核。",
+ "requestedTitle": "申请已发送",
+ "requested": "已申请",
+ "request": "申请加入",
+ "notNow": "暂不",
+ "successTitle": "已加入",
+ "successDescription": "你现在是 {{workspace}} 的成员。",
+ "errorTitle": "无法加入"
+ },
"accept": {
"title": "加入工作区",
"description": "{{inviter}} 邀请你以{{role}}身份加入 {{workspace}}。",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index b6fb8ef1e..bde0c74c9 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -1160,8 +1160,6 @@
"nonBillableSeat": "僅管理員存取 · 無付費席次",
"managedBy": "帳單由 {{owner}} 管理。",
"addSeat": "新增席次",
- "startWithSeats_one": "以 {{count}} 個席次開始 Business",
- "startWithSeats_other": "以 {{count}} 個席次開始 Business",
"seatUpdated_one": "工作區容量已更新為 {{count}} 個席次",
"seatUpdated_other": "工作區容量已更新為 {{count}} 個席次",
"seatUpdateFailed": "無法更新工作區席次",
@@ -1990,6 +1988,14 @@
"description": "{{name}} 將成為 {{workspace}} 的擁有者。你的角色會變更為管理員,且只有新擁有者能將擁有權轉回。"
}
},
+ "joinRequests": {
+ "title": "加入申請",
+ "approve": "核准",
+ "deny": "拒絕",
+ "approved": "{{name}} 已加入工作區",
+ "denied": "已拒絕申請",
+ "errorTitle": "無法更新申請"
+ },
"teams": {
"title": "團隊",
"description": "授予團隊空間存取權的工作區成員群組。",
@@ -2372,12 +2378,6 @@
"undo": "復原",
"emptySpace": "還沒有筆記。這裡的筆記對 {{space}} 中的所有人可見。",
"emptyTeamHint": "與你共享的空間將顯示在這裡。",
- "lockedPitch": "建立共享空間,讓團隊筆記保持同步。",
- "planBlocked": {
- "title": "{{workspace}} 目前是 Free 方案",
- "description": "工作區有自己的訂閱,與你的個人方案相互獨立。團隊空間需要工作區的付費方案。",
- "cta": "查看工作區帳單"
- },
"noteCount_one": "{{count}} 則筆記",
"noteCount_other": "{{count}} 則筆記",
"accessRevoked": "你已無法存取 {{space}}",
@@ -3386,9 +3386,7 @@
"emailPlaceholder": "[email protected]",
"roleLabel": "角色",
"seatUsage": "已使用 {{used}} / {{seats}} 個席次",
- "seatLimit": "{{seats}} 個席次已全數使用。",
- "askOwner": "{{seats}} 個席次已全數使用。請聯絡工作區擁有者新增席次。",
- "manageSeats": "管理席次",
+ "seatCost": "將為你的方案新增一個席位 · 現在收取 {{amount}}。",
"submit": "傳送邀請",
"submitting": "傳送中…",
"sentTitle": "邀請已傳送",
@@ -3405,6 +3403,24 @@
"member": "使用工作區"
}
},
+ "join": {
+ "title": "加入你的團隊",
+ "domainTitle": "你的團隊已在 OpenWhispr",
+ "description": "這些工作區中有與你相同電子郵件網域的成員。",
+ "invitedDescription": "有人邀請你加入一個工作區。",
+ "invitedBy": "{{inviter}} 邀請你擔任{{role}}",
+ "memberCount_other": "{{count}} 位成員",
+ "join": "加入",
+ "requestErrorTitle": "無法送出申請",
+ "requestedDescription": "{{workspace}} 的管理員會進行審核。",
+ "requestedTitle": "申請已送出",
+ "requested": "已申請",
+ "request": "申請加入",
+ "notNow": "暫不",
+ "successTitle": "已加入",
+ "successDescription": "你現在是 {{workspace}} 的成員。",
+ "errorTitle": "無法加入"
+ },
"accept": {
"title": "加入工作區",
"description": "{{inviter}} 邀請你以 {{role}} 的身分加入 {{workspace}}。",
diff --git a/src/services/SyncService.ts b/src/services/SyncService.ts
index feb73351e..dd4061276 100644
--- a/src/services/SyncService.ts
+++ b/src/services/SyncService.ts
@@ -45,11 +45,14 @@ import {
recordUpdate404,
resolvePulledNoteFolderId,
resolvePullCursorAdvance,
+ resolveSyncConsent,
+ shouldRunAmbientTeamOnlyPass,
revokedNoteForkUpdate,
shouldSetOwnerFromCloud,
UPDATE_404_FORK_THRESHOLD,
type PurgedSpaceEntry,
type PurgedSpaceReason,
+ type SyncConsent,
} from "./syncPassPolicy";
function isHttpStatus(err: unknown, status: number): boolean {
@@ -218,31 +221,31 @@ export class SyncService {
private teamSpacesRetryTimer: ReturnType<typeof setTimeout> | null = null;
private teamSpacesRetryAttempt = 0;
private openNoteSyncTimer: ReturnType<typeof setInterval> | null = null;
+ // Set by any pass that actually moves team or shared content; drives the
+ // ambient team-only backoff (see shouldRunAmbientTeamOnlyPass).
+ private teamPassMovedWork = false;
+
+ private consent(): SyncConsent {
+ return resolveSyncConsent({
+ authValidated: hasValidatedAuthContext(),
+ signedIn: localStorage.getItem("isSignedIn") === "true",
+ backupEnabled: localStorage.getItem("cloudBackupEnabled") === "true",
+ subscribed: readIsSubscribed(),
+ backupAllowedByPolicy: isCloudBackupAllowed(usePolicyStore.getState()),
+ });
+ }
canSync(): boolean {
- return (
- hasValidatedAuthContext() &&
- localStorage.getItem("isSignedIn") === "true" &&
- localStorage.getItem("cloudBackupEnabled") === "true" &&
- readIsSubscribed() &&
- isCloudBackupAllowed(usePolicyStore.getState())
- );
+ return this.consent().backup;
}
- // Sharing a note is per-note consent: shared notes keep syncing even when
- // the global cloud-backup toggle is off, as long as the account can sync.
private canSyncSharedNotes(): boolean {
- return (
- hasValidatedAuthContext() &&
- localStorage.getItem("isSignedIn") === "true" &&
- readIsSubscribed()
- );
+ return this.consent().shared;
}
- // Team-space membership, like sharing, is per-space consent: team content
- // syncs while signed in + subscribed even when cloud backup is off (D7).
+ // Team-space membership is per-space consent on the same terms as sharing.
private canSyncTeamSpaces(): boolean {
- return this.canSyncSharedNotes();
+ return this.consent().shared;
}
// Whether the API supports team scope (GET /api/me/teams deployed); probed
@@ -251,6 +254,26 @@ export class SyncService {
return readTeamSpacesCapability();
}
+ private ambientTeamPassDue(): boolean {
+ return shouldRunAmbientTeamOnlyPass({
+ emptyStreak: Number(localStorage.getItem("teamOnlyPass.emptyStreak") ?? 0),
+ lastPassAt: Number(localStorage.getItem("teamOnlyPass.lastAt")) || null,
+ now: Date.now(),
+ });
+ }
+
+ // Recorded only for team-only passes: a full pass runs on the backup
+ // schedule regardless, and letting it clear the streak would restart the
+ // 5-minute cadence the moment backup was switched off.
+ private recordTeamOnlyPass(): void {
+ const streak = Number(localStorage.getItem("teamOnlyPass.emptyStreak") ?? 0);
+ localStorage.setItem(
+ "teamOnlyPass.emptyStreak",
+ String(this.teamPassMovedWork ? 0 : streak + 1)
+ );
+ localStorage.setItem("teamOnlyPass.lastAt", String(Date.now()));
+ }
+
private cacheTeamSpacesCapability(available: boolean): void {
writeTeamSpacesCapability(available);
localStorage.setItem("teamSpacesCapability.probedAt", new Date().toISOString());
@@ -441,6 +464,7 @@ export class SyncService {
return;
}
this.syncing = true;
+ this.teamPassMovedWork = false;
let teamSpacesReady = false;
try {
// Ambient passes skip when another window holds the lock — that pass
@@ -476,6 +500,7 @@ export class SyncService {
await this.syncFolders(true);
if (!hasValidatedAuthContext()) return;
await this.syncNotes(true);
+ this.recordTeamOnlyPass();
}
if (!hasValidatedAuthContext()) return;
if (teamSpacesReady) {
@@ -527,6 +552,16 @@ export class SyncService {
) {
return;
}
+ // A team-only pass with nothing to move backs off; a local push
+ // ("team-push") and anything the user asked for are never held back.
+ if (
+ !bypassThrottle &&
+ reason !== "team-push" &&
+ !this.canSync() &&
+ !this.ambientTeamPassDue()
+ ) {
+ return;
+ }
void this.syncAll(waitForLock);
}
@@ -913,6 +948,7 @@ export class SyncService {
return false;
}
this.cacheTeamSpacesCapability(true);
+ if (cloudSpaces.length > 0) this.teamPassMovedWork = true;
const cloudIds = new Set(cloudSpaces.map((s) => s.id));
// Spaces confirmed gone can no longer resurrect through pulls — their
@@ -1454,6 +1490,7 @@ export class SyncService {
const teamCapable = this.canSyncTeamSpaces() && this.hasTeamSpacesCapability();
const scope = teamCapable ? "all" : undefined;
const { folders: cloudFolders } = await FoldersService.list(since, scope);
+ if (cloudFolders.length > 0) this.teamPassMovedWork = true;
const ctx = await this.buildSpaceContext();
// Parked or failed rows must retry: they hold the cursor back (and fail
// a backfill) so one bad row never drops the rest of the delta.
@@ -1658,6 +1695,7 @@ export class SyncService {
const pending =
(await window.electronAPI.getPendingNotes?.(teamOnly ? "team" : undefined)) ?? [];
if (pending.length === 0) return;
+ this.teamPassMovedWork = true;
const { localToCloud, blockedFolderIds } = await this.buildLocalToCloudFolderMap();
const ctx = await this.buildSpaceContext();
@@ -1830,6 +1868,7 @@ export class SyncService {
? await NotesService.list(BATCH_SIZE, undefined, cursor, scope, cursorId)
: await NotesService.list(BATCH_SIZE, cursor, undefined, scope, cursorId);
if (cloudNotes.length === 0) break;
+ this.teamPassMovedWork = true;
for (const cloudNote of cloudNotes) {
const local = await window.electronAPI.getNoteByClientId?.(
diff --git a/src/services/WorkspacesService.ts b/src/services/WorkspacesService.ts
index 90be804ca..1c7acc330 100644
--- a/src/services/WorkspacesService.ts
+++ b/src/services/WorkspacesService.ts
@@ -1,5 +1,10 @@
import { cloudGet, cloudPost, cloudPatch, cloudDelete, type DataWrap } from "./cloudApi.js";
-import type { Workspace, WorkspaceMember } from "../types/electron";
+import type {
+ JoinableWorkspace,
+ Workspace,
+ WorkspaceJoinRequest,
+ WorkspaceMember,
+} from "../types/electron";
export interface SeatPreview {
next_quantity: number;
@@ -50,12 +55,11 @@ async function removeMember(workspaceId: string, userId: string): Promise<void>
async function billingCheckout(
workspaceId: string,
- interval: "monthly" | "annual" = "monthly",
- additionalSeats = 0
+ interval: "monthly" | "annual" = "monthly"
): Promise<string> {
const res = await cloudPost<DataWrap<{ url: string }>>(
`/api/workspaces/${workspaceId}/billing/checkout`,
- { interval, additional_seats: additionalSeats }
+ { interval }
);
return res.data.url;
}
@@ -88,7 +92,46 @@ async function updateSeats(
return res.data;
}
+/** Workspaces the caller can join: pending invitations plus opted-in domain matches. */
+async function listJoinable(): Promise<JoinableWorkspace[]> {
+ const res = await cloudGet<DataWrap<JoinableWorkspace[]>>("/api/me/joinable");
+ return res.data;
+}
+
+async function join(workspaceId: string): Promise<{ workspace_id: string; role: string }> {
+ const res = await cloudPost<DataWrap<{ workspace_id: string; role: string }>>(
+ "/api/me/joinable",
+ { workspace_id: workspaceId }
+ );
+ return res.data;
+}
+
+/** Ask a workspace's admins for access. Grants nothing until one approves. */
+async function requestJoin(workspaceId: string): Promise<void> {
+ await cloudPost("/api/me/joinable/request", { workspace_id: workspaceId });
+}
+
+async function listJoinRequests(workspaceId: string): Promise<WorkspaceJoinRequest[]> {
+ const res = await cloudGet<DataWrap<WorkspaceJoinRequest[]>>(
+ `/api/workspaces/${workspaceId}/join-requests`
+ );
+ return res.data;
+}
+
+async function decideJoinRequest(
+ workspaceId: string,
+ requestId: string,
+ decision: "approve" | "deny"
+): Promise<void> {
+ await cloudPatch(`/api/workspaces/${workspaceId}/join-requests/${requestId}`, { decision });
+}
+
export const WorkspacesService = {
+ listJoinable,
+ join,
+ requestJoin,
+ listJoinRequests,
+ decideJoinRequest,
list,
create,
update,
diff --git a/src/services/membershipActions.ts b/src/services/membershipActions.ts
new file mode 100644
index 000000000..38db288a2
--- /dev/null
+++ b/src/services/membershipActions.ts
@@ -0,0 +1,18 @@
+import { syncService } from "./SyncService";
+import { useWorkspaceStore } from "../stores/workspaceStore";
+
+/**
+ * Everything that has to happen once an account gains workspace membership,
+ * shared by the emailed-invitation flow and the post-signup join screen so
+ * neither drifts from the other.
+ */
+export async function afterWorkspaceJoined(): Promise<void> {
+ await useWorkspaceStore.getState().refresh();
+ // Membership can change the caller's entitlement. Sync no longer depends on
+ // it — collaboration is plan-independent — but the plan badge and word
+ // limit still do.
+ window.dispatchEvent(new Event("usage-changed"));
+ // Pull the spaces this membership just unlocked; skeleton rows render while
+ // their backfill is pending.
+ syncService.requestSyncAll("manual");
+}
diff --git a/src/services/syncPassPolicy.ts b/src/services/syncPassPolicy.ts
index 89a40ba53..f48f2db4d 100644
--- a/src/services/syncPassPolicy.ts
+++ b/src/services/syncPassPolicy.ts
@@ -1,6 +1,64 @@
// Pure decision logic for sync passes, kept out of SyncService so the
// node --test suite can cover it (the cloudSyncGuards.js precedent, #1290).
+export interface SyncConsent {
+ /** Backup of everything the user has NOT explicitly shared. */
+ backup: boolean;
+ /** Shared notes and team-space content. */
+ shared: boolean;
+}
+
+/**
+ * What the account has consented to sync. Backup is a blanket copy of private
+ * content, so it stays behind the plan, the cloud-backup toggle, and org
+ * policy. Sharing a note or joining a team space is per-item consent the user
+ * gave deliberately, so it syncs whenever they are signed in — collaboration
+ * is not a paid feature, and gating it on the *invitee's* plan silently
+ * stranded free teammates in workspaces they had already been added to.
+ */
+export function resolveSyncConsent(state: {
+ authValidated: boolean;
+ signedIn: boolean;
+ backupEnabled: boolean;
+ subscribed: boolean;
+ backupAllowedByPolicy: boolean;
+}): SyncConsent {
+ const shared = state.authValidated && state.signedIn;
+ return {
+ shared,
+ backup: shared && state.backupEnabled && state.subscribed && state.backupAllowedByPolicy,
+ };
+}
+
+const TEAM_ONLY_PASS_BASE_MS = 5 * 60 * 1000;
+const TEAM_ONLY_PASS_MAX_MS = 60 * 60 * 1000;
+
+/**
+ * Backoff for ambient team-only passes — the passes that run when cloud backup
+ * is off, so their only job is moving shared notes and team-space content.
+ * Once collaboration stopped being a paid feature most signed-in accounts run
+ * these, and the majority have neither shared notes nor team spaces: three
+ * requests every five minutes to confirm nothing changed.
+ *
+ * Each consecutive pass that moves nothing doubles the wait to a one-hour
+ * ceiling; the first pass that moves anything resets it, so an active
+ * collaborator is never slower than before. Deliberate work — a manual sync,
+ * a local push, a retry — bypasses this entirely.
+ */
+export function teamOnlyPassDelayMs(emptyStreak: number): number {
+ if (emptyStreak <= 1) return 0;
+ return Math.min(TEAM_ONLY_PASS_MAX_MS, TEAM_ONLY_PASS_BASE_MS * 2 ** (emptyStreak - 1));
+}
+
+export function shouldRunAmbientTeamOnlyPass(state: {
+ emptyStreak: number;
+ lastPassAt: number | null;
+ now: number;
+}): boolean {
+ if (state.lastPassAt == null) return true;
+ return state.now - state.lastPassAt >= teamOnlyPassDelayMs(state.emptyStreak);
+}
+
export interface PullCursorAdvance {
// The pass's own cursor ("lastSyncedAt.<kind>", or ".<kind>.team" on a
// team-only pass).
diff --git a/src/types/electron.ts b/src/types/electron.ts
index bf7e2bf2d..720041ef5 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -384,6 +384,42 @@ export interface WorkspaceInvitation {
revoked_at: string | null;
}
+export interface JoinableMember {
+ name: string | null;
+ email: string;
+ image: string | null;
+}
+
+/**
+ * A workspace the signed-in user can act on, from GET /api/me/joinable.
+ * `source` is why they can see it, `mode` is what the button does: an
+ * invitation or an opted-in domain joins outright, a plain domain match only
+ * earns the right to ask an admin.
+ */
+export interface JoinableWorkspace {
+ source: "invitation" | "domain";
+ mode: "join" | "request";
+ request_state: "none" | "pending";
+ invitation_id: string | null;
+ workspace_id: string;
+ workspace_name: string;
+ workspace_slug: string;
+ role: WorkspaceRole;
+ member_count: number;
+ members: JoinableMember[];
+ inviter_name: string | null;
+ inviter_email: string | null;
+}
+
+export interface WorkspaceJoinRequest {
+ id: string;
+ user_id: string;
+ name: string | null;
+ email: string;
+ image: string | null;
+ created_at: string;
+}
+
export interface InvitationPreview {
id: string;
email: string;
diff --git a/src/utils/billingSeatIntent.ts b/src/utils/billingSeatIntent.ts
deleted file mode 100644
index c303232a0..000000000
--- a/src/utils/billingSeatIntent.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-const STORAGE_KEY = "settings.billingSeatIntent";
-// An intent is a short-lived handoff from the workspace section to the billing
-// section; expire it so an abandoned navigation doesn't resurface weeks later.
-const MAX_AGE_MS = 30 * 60 * 1000;
-
-export interface SeatIntent {
- workspaceId: string;
- additionalSeats: number;
- createdAt: number;
-}
-
-export function storeSeatIntent(workspaceId: string, additionalSeats: number): void {
- const intent: SeatIntent = { workspaceId, additionalSeats, createdAt: Date.now() };
- localStorage.setItem(STORAGE_KEY, JSON.stringify(intent));
-}
-
-export function readSeatIntent(): SeatIntent | null {
- try {
- const raw = localStorage.getItem(STORAGE_KEY);
- if (!raw) return null;
- const intent = JSON.parse(raw) as Partial<SeatIntent>;
- if (
- typeof intent.workspaceId !== "string" ||
- typeof intent.additionalSeats !== "number" ||
- typeof intent.createdAt !== "number" ||
- Date.now() - intent.createdAt > MAX_AGE_MS
- ) {
- clearSeatIntent();
- return null;
- }
- return intent as SeatIntent;
- } catch {
- try {
- clearSeatIntent();
- } catch {
- // Storage itself is unavailable; there is nothing else to clean up.
- }
- return null;
- }
-}
-
-export function clearSeatIntent(): void {
- localStorage.removeItem(STORAGE_KEY);
-}
diff --git a/test/services/syncPassPolicy.test.js b/test/services/syncPassPolicy.test.js
index e2b1f0d5b..856de00ff 100644
--- a/test/services/syncPassPolicy.test.js
+++ b/test/services/syncPassPolicy.test.js
@@ -3,6 +3,98 @@ const assert = require("node:assert/strict");
const load = () => import("../../src/services/syncPassPolicy.ts");
+// --- resolveSyncConsent -----------------------------------------------------
+// Backup is a blanket copy of private content; sharing and team spaces are
+// per-item consent. Conflating the two is what stranded free teammates in
+// workspaces they had already been added to.
+
+const SIGNED_IN = {
+ authValidated: true,
+ signedIn: true,
+ backupEnabled: true,
+ subscribed: true,
+ backupAllowedByPolicy: true,
+};
+
+test("consent: a free account still syncs shared notes and team spaces", async () => {
+ const { resolveSyncConsent } = await load();
+ const consent = resolveSyncConsent({
+ ...SIGNED_IN,
+ subscribed: false,
+ backupEnabled: false,
+ });
+ assert.equal(consent.shared, true);
+ // The paid boundary holds: private content is still not backed up.
+ assert.equal(consent.backup, false);
+});
+
+test("consent: sharing survives the cloud-backup toggle being off", async () => {
+ const { resolveSyncConsent } = await load();
+ const consent = resolveSyncConsent({ ...SIGNED_IN, backupEnabled: false });
+ assert.deepEqual(consent, { shared: true, backup: false });
+});
+
+test("consent: backup needs the plan, the toggle, and org policy together", async () => {
+ const { resolveSyncConsent } = await load();
+ assert.equal(resolveSyncConsent(SIGNED_IN).backup, true);
+ for (const off of ["backupEnabled", "subscribed", "backupAllowedByPolicy"]) {
+ assert.equal(
+ resolveSyncConsent({ ...SIGNED_IN, [off]: false }).backup,
+ false,
+ `backup must not run with ${off} off`
+ );
+ }
+});
+
+test("consent: nothing syncs without a validated signed-in session", async () => {
+ const { resolveSyncConsent } = await load();
+ for (const off of ["authValidated", "signedIn"]) {
+ assert.deepEqual(
+ resolveSyncConsent({ ...SIGNED_IN, [off]: false }),
+ { shared: false, backup: false },
+ `${off} off must stop every pass`
+ );
+ }
+});
+
+// --- ambient team-only pass backoff ----------------------------------------
+// Most signed-in accounts have no shared notes and no team spaces; before the
+// backoff they spent three requests every five minutes confirming that.
+
+test("team-only backoff: an account that keeps finding work never slows down", async () => {
+ const { teamOnlyPassDelayMs, shouldRunAmbientTeamOnlyPass } = await load();
+ assert.equal(teamOnlyPassDelayMs(0), 0);
+ // One empty pass is not a pattern — stay on the normal interval.
+ assert.equal(teamOnlyPassDelayMs(1), 0);
+ assert.equal(shouldRunAmbientTeamOnlyPass({ emptyStreak: 0, lastPassAt: 1000, now: 1001 }), true);
+});
+
+test("team-only backoff: consecutive empty passes double up to an hour", async () => {
+ const { teamOnlyPassDelayMs } = await load();
+ assert.equal(teamOnlyPassDelayMs(2), 10 * 60 * 1000);
+ assert.equal(teamOnlyPassDelayMs(3), 20 * 60 * 1000);
+ assert.equal(teamOnlyPassDelayMs(4), 40 * 60 * 1000);
+ // Ceiling holds no matter how long the account stays idle.
+ for (const streak of [5, 6, 20, 500]) {
+ assert.equal(teamOnlyPassDelayMs(streak), 60 * 60 * 1000, `streak ${streak}`);
+ }
+});
+
+test("team-only backoff: an idle account waits, and the first launch always runs", async () => {
+ const { shouldRunAmbientTeamOnlyPass } = await load();
+ const now = 10 * 60 * 60 * 1000;
+ assert.equal(
+ shouldRunAmbientTeamOnlyPass({ emptyStreak: 4, lastPassAt: now - 39 * 60 * 1000, now }),
+ false
+ );
+ assert.equal(
+ shouldRunAmbientTeamOnlyPass({ emptyStreak: 4, lastPassAt: now - 41 * 60 * 1000, now }),
+ true
+ );
+ // No recorded pass (fresh profile) must never be held back.
+ assert.equal(shouldRunAmbientTeamOnlyPass({ emptyStreak: 9, lastPassAt: null, now }), true);
+});
+
// --- resolvePullCursorAdvance ----------------------------------------------
// The matrix mirrors SyncService's pullFolders/pullNotes cursor semantics: a
// wrongly advanced cursor silently drops teammate edits from the delta pulls.
diff --git a/test/utils/billingSeatIntent.test.js b/test/utils/billingSeatIntent.test.js
deleted file mode 100644
index 0ddf27018..000000000
--- a/test/utils/billingSeatIntent.test.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const test = require("node:test");
-const assert = require("node:assert/strict");
-
-const load = () => import("../../src/utils/billingSeatIntent.ts");
-
-function installLocalStorage() {
- const values = new Map();
- const previous = global.localStorage;
- global.localStorage = {
- getItem: (key) => values.get(key) ?? null,
- setItem: (key, value) => values.set(key, String(value)),
- removeItem: (key) => values.delete(key),
- };
- return {
- restore: () => {
- global.localStorage = previous;
- },
- };
-}
-
-test("readSeatIntent clears malformed stored JSON", async (t) => {
- const { restore } = installLocalStorage();
- t.after(restore);
- const { readSeatIntent } = await load();
-
- localStorage.setItem("settings.billingSeatIntent", "{not-json");
-
- assert.equal(readSeatIntent(), null);
- assert.equal(localStorage.getItem("settings.billingSeatIntent"), null);
-});