From ba529ad14ed582b1e23f01656e70168b9b54b7e1 Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Sat, 28 Mar 2026 18:20:56 -0700 Subject: [PATCH] hide google and azure idp properly --- .../settings/(private)/idp/create/page.tsx | 2 - src/app/admin/idp/create/page.tsx | 135 ++++++++++-------- .../idp/OidcIdpProviderTypeSelect.tsx | 96 +++++++------ 3 files changed, 128 insertions(+), 105 deletions(-) diff --git a/src/app/[orgId]/settings/(private)/idp/create/page.tsx b/src/app/[orgId]/settings/(private)/idp/create/page.tsx index 17adcb6b6..c0fc30a8f 100644 --- a/src/app/[orgId]/settings/(private)/idp/create/page.tsx +++ b/src/app/[orgId]/settings/(private)/idp/create/page.tsx @@ -219,7 +219,6 @@ export default function Page() { } const disabled = !isPaidUser(tierMatrix.orgOidc); - const templatesPaid = isPaidUser(tierMatrix.orgOidc); return ( <> @@ -254,7 +253,6 @@ export default function Page() { { applyOidcIdpProviderType(form.setValue, next); }} diff --git a/src/app/admin/idp/create/page.tsx b/src/app/admin/idp/create/page.tsx index 40d4a3b32..5039d255c 100644 --- a/src/app/admin/idp/create/page.tsx +++ b/src/app/admin/idp/create/page.tsx @@ -36,7 +36,7 @@ import { tierMatrix } from "@server/lib/billing/tierMatrix"; import { InfoIcon } from "lucide-react"; import { useTranslations } from "next-intl"; import { useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -93,17 +93,18 @@ export default function Page() { }); const watchedType = form.watch("type"); - - useEffect(() => { - if ( - !templatesPaid && - (watchedType === "google" || watchedType === "azure") - ) { - applyOidcIdpProviderType(form.setValue, "oidc"); - } - }, [templatesPaid, watchedType, form.setValue]); + const templatesLocked = + !templatesPaid && + (watchedType === "google" || watchedType === "azure"); async function onSubmit(data: CreateIdpFormValues) { + if ( + !templatesPaid && + (data.type === "google" || data.type === "azure") + ) { + return; + } + setCreateLoading(true); try { @@ -166,10 +167,6 @@ export default function Page() { - {!templatesPaid ? ( - - ) : null} - @@ -181,64 +178,79 @@ export default function Page() { + {templatesLocked ? ( +
+ +
+ ) : null} { applyOidcIdpProviderType(form.setValue, next); }} /> - -
- - ( - - - {t("name")} - - - - - - {t("idpDisplayName")} - - - - )} - /> - -
- + + + + ( + + + {t("name")} + + + + + + {t("idpDisplayName")} + + + )} - onCheckedChange={(checked) => { - form.setValue( - "autoProvision", - checked - ); - }} /> -
- - {t("idpAutoProvisionUsersDescription")} - - - -
+ +
+ { + form.setValue( + "autoProvision", + checked + ); + }} + /> +
+ + {t( + "idpAutoProvisionUsersDescription" + )} + + + + +
+
{watchedType === "google" && ( @@ -624,6 +636,7 @@ export default function Page() { )} +
@@ -638,7 +651,7 @@ export default function Page() {