Skip to content

Commit a7977af

Browse files
authored
Merge pull request #1088 from trycompai/main
[comp] Production Deploy
2 parents c6d7900 + 66c2267 commit a7977af

14 files changed

Lines changed: 208 additions & 286 deletions

File tree

apps/app/src/actions/organization/initialize-organization-action.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

apps/app/src/app/(app)/[orgId]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default async function Layout({
8383
},
8484
});
8585

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

apps/app/src/app/(app)/[orgId]/settings/billing/page.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export default function BillingPage() {
8080
'Community Support',
8181
],
8282
trialDays: 14,
83+
minimumTermMonths: 12,
8384
},
8485
managed: {
8586
displayName: 'Done For You',
@@ -98,10 +99,16 @@ export default function BillingPage() {
9899

99100
const currentPlanConfig = planConfig[planType];
100101

101-
// Calculate if minimum term has been met for managed plans
102+
// Calculate if minimum term has been met for both starter and managed plans
102103
const hasMetMinimumTerm = () => {
104+
// Free trials can be cancelled anytime
105+
if (isTrialing) {
106+
return true;
107+
}
108+
109+
// Only enforce minimum term for starter and managed plans
103110
if (
104-
planType !== 'managed' ||
111+
(planType !== 'starter' && planType !== 'managed') ||
105112
!('currentPeriodStart' in subscription) ||
106113
subscription.currentPeriodStart == null
107114
) {
@@ -113,15 +120,25 @@ export default function BillingPage() {
113120
const monthsElapsed =
114121
(now.getFullYear() - startDate.getFullYear()) * 12 + (now.getMonth() - startDate.getMonth());
115122

116-
return monthsElapsed >= (planConfig.managed.minimumTermMonths || 12);
123+
const minimumTermMonths =
124+
planType === 'starter'
125+
? planConfig.starter.minimumTermMonths
126+
: planConfig.managed.minimumTermMonths;
127+
128+
return monthsElapsed >= (minimumTermMonths || 12);
117129
};
118130

119131
const canCancelSubscription = hasMetMinimumTerm();
120132

121133
// Calculate when cancellation will be available
122134
const getCancellationAvailableDate = () => {
135+
// Free trials don't have minimum term
136+
if (isTrialing) {
137+
return null;
138+
}
139+
123140
if (
124-
planType !== 'managed' ||
141+
(planType !== 'starter' && planType !== 'managed') ||
125142
!('currentPeriodStart' in subscription) ||
126143
subscription.currentPeriodStart == null
127144
) {
@@ -130,9 +147,12 @@ export default function BillingPage() {
130147

131148
const startDate = new Date(subscription.currentPeriodStart * 1000);
132149
const cancellationDate = new Date(startDate);
133-
cancellationDate.setMonth(
134-
cancellationDate.getMonth() + (planConfig.managed.minimumTermMonths || 12),
135-
);
150+
const minimumTermMonths =
151+
planType === 'starter'
152+
? planConfig.starter.minimumTermMonths
153+
: planConfig.managed.minimumTermMonths;
154+
155+
cancellationDate.setMonth(cancellationDate.getMonth() + (minimumTermMonths || 12));
136156

137157
return cancellationDate;
138158
};
@@ -349,8 +369,8 @@ export default function BillingPage() {
349369
</p>
350370
{planType === 'starter' && (
351371
<p className="text-sm">
352-
Add a payment method now to continue after your 14-day trial. You won't be charged
353-
until the trial ends.
372+
Add a payment method now to continue after your trial. You won't be charged until
373+
the trial ends. Note: This plan requires a 12-month minimum commitment.
354374
</p>
355375
)}
356376
{planType === 'managed' && (
@@ -469,7 +489,7 @@ export default function BillingPage() {
469489
</div>
470490
)}
471491

472-
{planType === 'managed' &&
492+
{(planType === 'starter' || planType === 'managed') &&
473493
!canCancelSubscription &&
474494
getCancellationAvailableDate() && (
475495
<div className="flex items-center justify-between">

apps/app/src/app/(app)/setup/actions/create-organization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const createOrganization = authActionClientWithoutOrg
6868
await db.onboarding.create({
6969
data: {
7070
organizationId: orgId,
71-
completed: false,
71+
triggerJobCompleted: false,
7272
},
7373
});
7474

apps/app/src/app/(app)/upgrade/[orgId]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const pricingFaqData = [
2323
id: 'free-trial',
2424
question: 'Is there a free trial available?',
2525
answer:
26-
'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.',
26+
"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.",
2727
},
2828
{
2929
id: 'how-it-works',

0 commit comments

Comments
 (0)