feat: Add configurable trial days to org subscriptions + wizard warning (#25229)
* feat: Add trial days to organization subscriptions and workspace warning - Add ORGANIZATION_TRIAL_DAYS environment variable for configurable trial periods - Implement trial days in Stripe checkout session (only when env var is set) - Add warning message to organization setup page about workspace structure - Add translation string for organization trial workspace warning - Add ORGANIZATION_TRIAL_DAYS to turbo.json env vars - Fix pre-existing linting warnings in CreateANewOrganizationForm.tsx - Add ESLint disable comments for turbo/no-undeclared-env-vars warnings Co-Authored-By: [email protected] <[email protected]> * Rename variable * Add trial days to `purchaseTeamOrOrgSubscription` * fix: Move organization trial warning to spot 3 below form card - Add optional footer prop to WizardLayout component - Use footer prop in create-new-view.tsx to render warning at spot 3 - Remove warning from inside CreateANewOrganizationForm component - Warning now appears below the form card as requested Co-Authored-By: [email protected] <[email protected]> * feat: Add organization trial warning to all wizard steps - Add warning footer to step 2 (about-view.tsx) - Add warning footer to step 3 (add-teams-view.tsx) - Add warning footer to step 4 (onboard-members-view.tsx) - Add warning footer to step 5 (payment-status-view.tsx) - Add warning footer to resume-view.tsx (step 1 resume page) - Warning now appears on all steps of the organization creation wizard Co-Authored-By: [email protected] <[email protected]> * fix: Correct environment variable name to STRIPE_ORG_TRIAL_DAYS - Changed ORGANIZATION_TRIAL_DAYS to STRIPE_ORG_TRIAL_DAYS in turbo.json - This matches the actual usage in OrganizationPaymentService.ts and payments.ts - Ensures the environment variable is properly recognized by the build system Co-Authored-By: [email protected] <[email protected]> * refactor: Create shared OrganizationWizardLayout component - Create OrganizationWizardLayout component that wraps WizardLayout - Centralizes the trial warning footer logic in one place - Update all 6 wizard pages to use the shared component: - create-new-view.tsx - about-view.tsx - add-teams-view.tsx - onboard-members-view.tsx - payment-status-view.tsx - resume-view.tsx - Remove duplicate useLocale/Alert imports and footer props from pages - Simplifies maintenance by having warning logic in a single location Co-Authored-By: [email protected] <[email protected]> * Fix lint error * Add `ORG_TRIAL_DAYS` as constant * Add comment * Ensure no negative number is passed --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
15 files changed
+77
-46
No files matched your search
@@ -0,0 +1,35 @@
|
||||
"use client";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Alert } from "@calcom/ui/components/alert";
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
|
||||
interface OrganizationWizardLayoutProps {
|
||||
children: React.ReactNode;
|
||||
currentStep: number;
|
||||
maxSteps?: number;
|
||||
isOptionalCallback?: () => void;
|
||||
footer?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function OrganizationWizardLayout({
|
||||
children,
|
||||
currentStep,
|
||||
maxSteps = 5,
|
||||
isOptionalCallback,
|
||||
footer,
|
||||
}: OrganizationWizardLayoutProps) {
|
||||
const { t } = useLocale();
|
||||
|
||||
const defaultFooter = <Alert severity="warning" message={t("organization_trial_workspace_warning")} />;
|
||||
|
||||
return (
|
||||
<WizardLayout
|
||||
currentStep={currentStep}
|
||||
maxSteps={maxSteps}
|
||||
isOptionalCallback={isOptionalCallback}
|
||||
footer={footer ?? defaultFooter}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { AboutOrganizationForm } from "@calcom/features/ee/organizations/components";
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<WizardLayout currentStep={2} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={2}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
export default AboutOrganizationForm;
|
||||
@@ -1,15 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
|
||||
import { AddNewTeamsForm } from "./_components/AddNewTeamsForm";
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<WizardLayout currentStep={3} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={3}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
export default AddNewTeamsForm;
|
||||
@@ -3,9 +3,10 @@
|
||||
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";
|
||||
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
const { t } = useLocale();
|
||||
const { isPlatformUser } = useGetUserAttributes();
|
||||
@@ -20,11 +21,7 @@ export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<WizardLayout currentStep={1} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={1}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
export default CreateANewOrganizationForm;
|
||||
@@ -1,15 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
|
||||
import AddNewTeamMembers from "./_components/OnboardMembersView";
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<WizardLayout currentStep={4} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={4}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
export default AddNewTeamMembers;
|
||||
@@ -1,15 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
|
||||
import PaymentStatusView from "~/settings/organizations/new/_components/PaymentStatusView";
|
||||
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<WizardLayout currentStep={5} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={5}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
export default PaymentStatusView;
|
||||
@@ -6,15 +6,12 @@ import { useEffect } from "react";
|
||||
import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Alert } from "@calcom/ui/components/alert";
|
||||
import { WizardLayout } from "@calcom/ui/components/layout";
|
||||
import { SkeletonContainer, SkeletonText } from "@calcom/ui/components/skeleton";
|
||||
|
||||
import { OrganizationWizardLayout } from "./_components/OrganizationWizardLayout";
|
||||
|
||||
export const LayoutWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
return (
|
||||
<WizardLayout currentStep={1} maxSteps={5}>
|
||||
{children}
|
||||
</WizardLayout>
|
||||
);
|
||||
return <OrganizationWizardLayout currentStep={1}>{children}</OrganizationWizardLayout>;
|
||||
};
|
||||
|
||||
const ResumeOnboardingView = () => {
|
||||
|
||||
Reference in new issue
Block a user