From ab1c1bb0156a042f092d1db0d31e6c9807ff9a83 Mon Sep 17 00:00:00 2001 From: Lauris Skraucis Date: Wed, 30 Apr 2025 10:33:01 +0200 Subject: [PATCH] fix: allow only platform organisation or non-platform organisation (#20972) * fix: platform customers cant subscribe to organizations plan * fix: organization customers cant subscribe to platform plan --- .../organizations/new/create-new-view.tsx | 16 ++++++++++++++++ .../settings/platform/new/create-new-view.tsx | 16 ++++++++++++++++ apps/web/public/static/locales/en/common.json | 2 ++ 3 files changed, 34 insertions(+) diff --git a/apps/web/modules/settings/organizations/new/create-new-view.tsx b/apps/web/modules/settings/organizations/new/create-new-view.tsx index 218717f3b4..395669b427 100644 --- a/apps/web/modules/settings/organizations/new/create-new-view.tsx +++ b/apps/web/modules/settings/organizations/new/create-new-view.tsx @@ -1,9 +1,25 @@ "use client"; import { CreateANewOrganizationForm } from "@calcom/features/ee/organizations/components"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { Alert } from "@calcom/ui/components/alert"; import { WizardLayout } from "@calcom/ui/components/layout"; +import { useGetUserAttributes } from "@calcom/web/components/settings/platform/hooks/useGetUserAttributes"; export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => { + const { t } = useLocale(); + const { isPlatformUser } = useGetUserAttributes(); + + if (isPlatformUser) { + return ( +
+
+ +
+
+ ); + } + return ( {children} diff --git a/apps/web/modules/settings/platform/new/create-new-view.tsx b/apps/web/modules/settings/platform/new/create-new-view.tsx index d997ea45a3..6673251c6e 100644 --- a/apps/web/modules/settings/platform/new/create-new-view.tsx +++ b/apps/web/modules/settings/platform/new/create-new-view.tsx @@ -1,9 +1,25 @@ "use client"; import { CreateANewPlatformForm } from "@calcom/features/ee/platform/components/index"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { Alert } from "@calcom/ui/components/alert"; import { WizardLayout } from "@calcom/ui/components/layout"; +import { useGetUserAttributes } from "@calcom/web/components/settings/platform/hooks/useGetUserAttributes"; export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => { + const { t } = useLocale(); + const { isPlatformUser, userOrgId } = useGetUserAttributes(); + + if (!isPlatformUser && userOrgId) { + return ( +
+
+ +
+
+ ); + } + return ( {children} diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 0f674ccd84..82e8899ffd 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -3147,6 +3147,8 @@ "meeting_not_joined_question": "didn't join the meeting?", "reschedule_cta_short": "Reschedule here.", "hide_organizer_email": "Hide organizer's email", + "platform_customer_cant_create_organization": "You are already part of a platform organization which is why you can't create a new organization. Each user can only belong to one organization. Please, create a new cal.com account with a different email and use that account to subscribe to the organizations plan.", + "organization_customer_cant_create_platform": "You are already part of an organization which is why you can't create a platform organization. Each user can only belong to one organization. Please, create a new cal.com account with a different email and use that account to subscribe to the platform plan.", "hide_organizer_email_description": "Hide organizer's email address from the booking screen, email notifications, and calendar events", "you_and_conjunction": "You &", "select_verified_email": "Select a verified email",