Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Settings: another email is added beside this account, not signed out for

milind-soni00d4943cef62
diff --git a/src/components/CloudAccountSettings.test.ts b/src/components/CloudAccountSettings.test.ts
index 84c11ce1dd..328faea717 100644
--- a/src/components/CloudAccountSettings.test.ts
+++ b/src/components/CloudAccountSettings.test.ts
@@ -144,9 +144,17 @@ it("a payment being linked says so, with its date, and asks nobody to pay again"
push({ ...free, purchase: { state: "held" } });
all(render().html, ["MausBot Cloud · payment received", "linking your payment"]); none(render().html, BUY);
});
+it("where this app can keep another account beside this one, the other email is added, with nothing signed out", async () => {
+ vi.stubGlobal("window", { ogb: { cloudAccount: bridge, accounts: { addCancel: vi.fn(), list: vi.fn(), onChanged: vi.fn() } } });
+ await ready(free);
+ none(render({ onAddCloud: vi.fn() }).html, ["Sign out and use that email"]);
+ button("Add that email")!.props.onClick!();
+ all(render({ onAddCloud: vi.fn() }).html, ["data-accounts-sheet", "cloud-add-email"]);
+ expect(bridge.signOut).not.toHaveBeenCalled();
+});
it("a free account may add a Cloud, and is told what to do if it bought with another email", async () => {
await ready(free);
- all(render({ onAddCloud: vi.fn() }).html, ["No plan yet", ">Add a Cloud<", "Bought a plan with a different email?"]);
+ all(render({ onAddCloud: vi.fn() }).html, ["No plan yet", ">Add a Cloud<", "Bought a plan or joined a team with a different email?"]);
none(render({ onAddCloud: vi.fn() }).html, ["Choose a Cloud plan", "Free account", "a checkout return alone"]);
button("Sign out and use that email")!.props.onClick!();
expect(render().html).toContain("does not cancel your subscription"); expect(bridge.signOut).not.toHaveBeenCalled();
diff --git a/src/components/CloudAccountSettings.tsx b/src/components/CloudAccountSettings.tsx
index 8fe0b07b71..3d939f39c4 100644
--- a/src/components/CloudAccountSettings.tsx
+++ b/src/components/CloudAccountSettings.tsx
@@ -8,6 +8,7 @@ import { activeLocale, t } from "@/lib/i18n";
import { buyOfferAllowed, cloudCreditLine, cloudPlanLabel, cloudPlanLine, cloudPlanView, cloudTrialView, moneyBackLine, offerTrialDays, trialRunning, type CloudPlanView } from "@/lib/cloud-plan";
import { useCloudOffer } from "@/lib/use-cloud-offer";
import type { LocaleKey } from "@/locales";
+import { AccountsSheet } from "./AccountMenu";
import { Card } from "./SettingsPrimitives";
import { CloudCancelPlan, type CloudRenewalActions } from "./CloudCancelPlan";
import { StagingMark } from "./cloud-buy/parts";
@@ -185,6 +186,7 @@ export function CloudAccountSettings({ linkRequest = 0, cloudHome = false, teamH
const { platform } = useDesktopCapabilities().capabilities.host;
const [account, setAccount] = useState<CloudAccountState | null>(null);
const [busy, setBusy] = useState(false), [error, setError] = useState(false), [confirm, setConfirm] = useState(false);
+ const [addingEmail, setAddingEmail] = useState(false);
const [homeFailed, setHomeFailed] = useState(false), [phoneFailed, setPhoneFailed] = useState(false);
const generation = useRef(0), revision = useRef(0), pending = useRef(false);
const link = useRef({ request: 0, arrived: false, connected: false });
@@ -305,7 +307,8 @@ export function CloudAccountSettings({ linkRequest = 0, cloudHome = false, teamH
</div>
{account.status === "connected" && account.renewal && <CloudCancelPlan renewal={account.renewal} actions={renewal} />}
{view.kind === "free" && !confirm && <p className="text-[12px] text-ink-secondary">{t("cloudAccount.otherEmail")}{" "}
- <button type="button" disabled={busy} className="underline hover:text-ink" onClick={() => setConfirm(true)}>{t("cloudAccount.useOtherEmail")}</button></p>}
+ <button type="button" data-cloud-other-email disabled={busy} className="underline hover:text-ink" onClick={() => (window.ogb?.accounts ? setAddingEmail(true) : setConfirm(true))}>{t(window.ogb?.accounts ? "cloudAccount.addOtherEmail" : "cloudAccount.useOtherEmail")}</button></p>}
+ {addingEmail && <AccountsSheet adding="" onClose={() => setAddingEmail(false)} />}
{confirm && <div role="group" aria-label={t("cloudAccount.signoutTitle")} className="rounded-lg border border-hairline/40 p-3">
<p className="text-[13px] text-ink-secondary">{t("cloudAccount.signoutHelp")}</p><div className="mt-3 flex flex-wrap gap-2">
<button type="button" autoFocus disabled={busy} className="ui-button" onClick={() => setConfirm(false)}>{t("cloudAccount.keep")}</button>
diff --git a/src/locales/en.json b/src/locales/en.json
index 9088bb4d5e..987da8dc3a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1046,8 +1046,9 @@
"cloudAccount.planName": "{plan} plan",
"cloudAccount.checking": "Checking with MausBot Cloud…",
"cloudAccount.attention": "Your plan is not active right now. Your Plan page shows why and how to fix it.",
- "cloudAccount.otherEmail": "Bought a plan with a different email?",
+ "cloudAccount.otherEmail": "Bought a plan or joined a team with a different email?",
"cloudAccount.useOtherEmail": "Sign out and use that email",
+ "cloudAccount.addOtherEmail": "Add that email",
"cloudAccount.upgrade": "Add a Cloud",
"cloudAccount.manage": "Manage Cloud subscription",
"cloudAccount.updatePayment": "Update payment in your browser",