Skip to content

Commit 80489af

Browse files
feat(automation): add enterprise feature check and user guidance (#2131)
Co-authored-by: Tofik Hasanov <annexcies@gmail.com>
1 parent 8f26e35 commit 80489af

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/automation/[automationId]/actions/task-automation-actions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ function getEnterpriseConfig() {
3434
const enterpriseApiKey = process.env.ENTERPRISE_API_SECRET;
3535

3636
if (!enterpriseApiKey) {
37-
throw new Error('Not authorized to access enterprise API');
37+
throw new EnterpriseApiError(
38+
'Task automations require an enterprise license. Please contact sales@trycomp.ai to learn more.',
39+
403,
40+
);
3841
}
3942

4043
return { enterpriseApiUrl, enterpriseApiKey };

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/automation/[automationId]/page.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { db } from '@db';
2+
import { ArrowLeft, Lock } from 'lucide-react';
3+
import Link from 'next/link';
24
import { redirect } from 'next/navigation';
35
import { loadChatHistory } from './actions/task-automation-actions';
46
import { AutomationLayoutWrapper } from './automation-layout-wrapper';
@@ -23,6 +25,37 @@ export default async function Page({
2325
redirect('/tasks');
2426
}
2527

28+
// Check if enterprise API is configured
29+
if (!process.env.ENTERPRISE_API_SECRET) {
30+
return (
31+
<div className="flex items-center justify-center min-h-screen bg-background">
32+
<div className="max-w-md w-full mx-auto p-8 text-center space-y-4">
33+
<div className="mx-auto w-12 h-12 rounded-full bg-muted flex items-center justify-center">
34+
<Lock className="w-6 h-6 text-muted-foreground" />
35+
</div>
36+
<h2 className="text-lg font-semibold text-foreground">Enterprise Feature</h2>
37+
<p className="text-sm text-muted-foreground">
38+
Task automations require an enterprise license. Contact{' '}
39+
<a
40+
href="mailto:sales@trycomp.ai"
41+
className="text-primary underline underline-offset-4 hover:text-primary/80"
42+
>
43+
sales@trycomp.ai
44+
</a>{' '}
45+
to learn more about enabling this feature.
46+
</p>
47+
<Link
48+
href={`/${orgId}/tasks/${taskId}`}
49+
className="inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mt-2"
50+
>
51+
<ArrowLeft className="w-4 h-4" />
52+
Back to task
53+
</Link>
54+
</div>
55+
</div>
56+
);
57+
}
58+
2659
const taskName = task.title;
2760

2861
// Load chat history server-side (skip for ephemeral 'new' automations)

0 commit comments

Comments
 (0)