Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

2 changes: 1 addition & 1 deletion apps/app/src/app/(app)/[orgId]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default async function Layout({
},
});

const isOnboardingRunning = !!onboarding?.triggerJobId && !onboarding.completed;
const isOnboardingRunning = !!onboarding?.triggerJobId && !onboarding.triggerJobCompleted;
const navbarHeight = 53 + 1; // 1 for border
const onboardingHeight = 132 + 1; // 1 for border

Expand Down
40 changes: 30 additions & 10 deletions apps/app/src/app/(app)/[orgId]/settings/billing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default function BillingPage() {
'Community Support',
],
trialDays: 14,
minimumTermMonths: 12,
},
managed: {
displayName: 'Done For You',
Expand All @@ -98,10 +99,16 @@ export default function BillingPage() {

const currentPlanConfig = planConfig[planType];

// Calculate if minimum term has been met for managed plans
// Calculate if minimum term has been met for both starter and managed plans
const hasMetMinimumTerm = () => {
// Free trials can be cancelled anytime
if (isTrialing) {
return true;
}

// Only enforce minimum term for starter and managed plans
if (
planType !== 'managed' ||
(planType !== 'starter' && planType !== 'managed') ||
!('currentPeriodStart' in subscription) ||
subscription.currentPeriodStart == null
) {
Expand All @@ -113,15 +120,25 @@ export default function BillingPage() {
const monthsElapsed =
(now.getFullYear() - startDate.getFullYear()) * 12 + (now.getMonth() - startDate.getMonth());

return monthsElapsed >= (planConfig.managed.minimumTermMonths || 12);
const minimumTermMonths =
planType === 'starter'
? planConfig.starter.minimumTermMonths
: planConfig.managed.minimumTermMonths;

return monthsElapsed >= (minimumTermMonths || 12);
};

const canCancelSubscription = hasMetMinimumTerm();

// Calculate when cancellation will be available
const getCancellationAvailableDate = () => {
// Free trials don't have minimum term
if (isTrialing) {
return null;
}

if (
planType !== 'managed' ||
(planType !== 'starter' && planType !== 'managed') ||
!('currentPeriodStart' in subscription) ||
subscription.currentPeriodStart == null
) {
Expand All @@ -130,9 +147,12 @@ export default function BillingPage() {

const startDate = new Date(subscription.currentPeriodStart * 1000);
const cancellationDate = new Date(startDate);
cancellationDate.setMonth(
cancellationDate.getMonth() + (planConfig.managed.minimumTermMonths || 12),
);
const minimumTermMonths =
planType === 'starter'
? planConfig.starter.minimumTermMonths
: planConfig.managed.minimumTermMonths;

cancellationDate.setMonth(cancellationDate.getMonth() + (minimumTermMonths || 12));

return cancellationDate;
};
Expand Down Expand Up @@ -349,8 +369,8 @@ export default function BillingPage() {
</p>
{planType === 'starter' && (
<p className="text-sm">
Add a payment method now to continue after your 14-day trial. You won't be charged
until the trial ends.
Add a payment method now to continue after your trial. You won't be charged until
the trial ends. Note: This plan requires a 12-month minimum commitment.
</p>
)}
{planType === 'managed' && (
Expand Down Expand Up @@ -469,7 +489,7 @@ export default function BillingPage() {
</div>
)}

{planType === 'managed' &&
{(planType === 'starter' || planType === 'managed') &&
!canCancelSubscription &&
getCancellationAvailableDate() && (
<div className="flex items-center justify-between">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const createOrganization = authActionClientWithoutOrg
await db.onboarding.create({
data: {
organizationId: orgId,
completed: false,
triggerJobCompleted: false,
},
});

Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/app/(app)/upgrade/[orgId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const pricingFaqData = [
id: 'free-trial',
question: 'Is there a free trial available?',
answer:
'Our Starter plan is completely free. For our Done For You plan, we offer competitive pricing without free trials since our services are already affordable.',
"We offer a 14-day money back guarantee on all plans. This gives you the confidence to try our services risk-free, knowing you can get a full refund if you're not completely satisfied within the first 14 days.",
},
{
id: 'how-it-works',
Expand Down
Loading
Loading