Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: remove SSO subscription management buttons
Richie McIlroy5d78ede287d3
diff --git a/apps/web/__tests__/unit/sso-settings.test.ts b/apps/web/__tests__/unit/sso-settings.test.tsindex e28d0011f..d216a38df 100644--- a/apps/web/__tests__/unit/sso-settings.test.ts+++ b/apps/web/__tests__/unit/sso-settings.test.ts@@ -414,6 +414,51 @@ describe("organization SSO settings authorization", () => {expect(markup).toContain("Add SAML SSO · €190.00/month");});+ it.each([false, true])(+ "keeps SSO controls without subscription management when cancellation is %s",+ async (cancelAtPeriodEnd) => {+ makeFixture();+ const { SsoCard } = await vi.importActual<+ typeof import("@/app/(org)/dashboard/settings/organization/components/SsoCard")+ >("@/app/(org)/dashboard/settings/organization/components/SsoCard");+ const markup = renderToStaticMarkup(+ createElement(SsoCard, {+ initialSettings: {+ ...(await getOrganizationSsoSettings(ORGANIZATION_ID)),+ cancelAtPeriodEnd,+ currentPeriodEnd: "2026-10-03T00:00:00Z",+ },+ }),+ );+ expect(markup).toContain("Manage SSO");+ expect(markup).toContain("Share your SSO sign-in link");+ expect(markup).not.toMatch(/Manage (SSO )?subscription/);+ if (cancelAtPeriodEnd) {+ expect(markup).toContain("scheduled to end on 3 October 2026");+ }+ },+ );++ it("provides support for unpaid SSO without subscription management or another purchase", async () => {+ makeFixture();+ const { SsoCard } = await vi.importActual<+ typeof import("@/app/(org)/dashboard/settings/organization/components/SsoCard")+ >("@/app/(org)/dashboard/settings/organization/components/SsoCard");+ const markup = renderToStaticMarkup(+ createElement(SsoCard, {+ initialSettings: {+ ...(await getOrganizationSsoSettings(ORGANIZATION_ID)),+ entitled: false,+ subscriptionStatus: "unpaid",+ },+ }),+ );+ expect(markup).toContain('href="mailto:[email protected]"');+ expect(markup).toContain("purchase it again");+ expect(markup).not.toMatch(/Manage (SSO )?subscription/);+ expect(markup).not.toContain("Add SAML SSO");+ });+it.each(["member", "stranger", "forged-owner"] as const)("denies %s access before opening setup or billing",async (role) => {diff --git a/apps/web/app/(org)/dashboard/settings/organization/components/SsoCard.tsx b/apps/web/app/(org)/dashboard/settings/organization/components/SsoCard.tsxindex 8a2415016..43b2c802b 100644--- a/apps/web/app/(org)/dashboard/settings/organization/components/SsoCard.tsx+++ b/apps/web/app/(org)/dashboard/settings/organization/components/SsoCard.tsx@@ -23,7 +23,6 @@ import { toast } from "sonner";import {confirmOrganizationSsoCheckout,getOrganizationSsoSettings,- manageOrganizationSsoBilling,type OrganizationSsoSettings,openOrganizationSsoPortal,startOrganizationSsoCheckout,@@ -34,12 +33,11 @@ import {type SupportedCurrency,} from "@/utils/currency";-type SsoAction = "checkout" | "portal" | "billing" | "refresh" | "confirm";+type SsoAction = "checkout" | "portal" | "refresh" | "confirm";const actionErrors: Record<SsoAction, string> = {checkout: "We couldn't open checkout. Please try again or contact support.",portal: "We couldn't open SSO setup. Please try again or contact support.",- billing: "We couldn't open billing. Please try again or contact support.",refresh: "We couldn't refresh SSO status. Please try again.",confirm:"We couldn't confirm your SSO subscription yet. Refresh the status to try again, or contact support if you've been charged.",@@ -210,13 +208,6 @@ export function SsoCard({});};- const openBilling = () => {- runAction("billing", async () => {- const { url } = await manageOrganizationSsoBilling(organizationId);- window.location.assign(url);- });- };-return (<Card><div className="flex flex-wrap gap-4 justify-between items-start">@@ -346,47 +337,25 @@ export function SsoCard({Verify domains</Button>)}- {settings.canManageBilling && settings.hasSubscription && (- <Button- type="button"- size="sm"- variant="gray"- onClick={openBilling}- disabled={busy}- spinner={pendingAction === "billing"}- >- Manage subscription- </Button>- )}</div>{settings.cancelAtPeriodEnd && (<p className="text-sm text-gray-11">- Your SSO add-on is scheduled to end {periodEndLabel}. Manage- your subscription to keep it active.+ Your SSO add-on is scheduled to end {periodEndLabel}.</p>)}</>) : settings.canManageBilling ? (<div className="flex flex-col gap-3">{hasExistingSubscription ? (- <>- <p className="text-sm text-gray-11">- Your SSO subscription needs attention before setup is- available. Manage the existing subscription to review its- payment status.- </p>- <Button- type="button"- size="sm"- variant="dark"- className="w-fit"- onClick={openBilling}- disabled={busy}- spinner={pendingAction === "billing"}- >- Manage SSO subscription- </Button>- </>+ <p className="text-sm text-gray-11">+ Your SSO subscription needs attention before setup is available.+ Contact{" "}+ <a className="underline" href="mailto:[email protected]">+ </a>{" "}+ for help with the existing subscription; you don't need to+ purchase it again.+ </p>) : (<div className="flex flex-wrap gap-3 items-end">{price && settings.prices.length > 1 && (