Skip to content

Commit dea2d03

Browse files
authored
Merge pull request #775 from trycompai/main
[comp] Production Deploy
2 parents 5e54e35 + 38e11d9 commit dea2d03

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

apps/app/src/app/[locale]/(app)/setup/onboarding/components/OnboardingForm.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { toast } from "sonner";
4949
import { motion, AnimatePresence } from "framer-motion";
5050
import { LogoSpinner } from "@/components/logo-spinner";
5151
import { SelectPills } from "@comp/ui/select-pills";
52+
import { Textarea } from "@comp/ui/textarea";
5253

5354
type OnboardingFormFields = Partial<CompanyDetails> & {
5455
[K in keyof CompanyDetails as `${K}Other`]?: string;
@@ -122,6 +123,7 @@ export function OnboardingForm() {
122123
onboardOrganizationAction.execute({
123124
legalName: answers.legalName || "",
124125
website: answers.website || "",
126+
describe: answers.describe || "",
125127
industry: answers.industry || "",
126128
teamSize: answers.teamSize || "",
127129
devices: answers.devices || "",
@@ -188,6 +190,18 @@ export function OnboardingForm() {
188190
const isLastStep = stepIndex === steps.length - 1;
189191

190192
function renderStepInput() {
193+
if (step.key === "describe") {
194+
return (
195+
<Textarea
196+
{...form.register(step.key)}
197+
placeholder={`${savedAnswers.legalName || ""} is a company that...`}
198+
rows={2}
199+
maxLength={300}
200+
className="resize-none"
201+
/>
202+
);
203+
}
204+
191205
if (step.options) {
192206
if (step.key === "industry" || step.key === "teamSize") {
193207
return (
@@ -230,6 +244,7 @@ export function OnboardingForm() {
230244
/>
231245
);
232246
}
247+
233248
return (
234249
<Input
235250
{...form.register(step.key)}

apps/app/src/app/[locale]/(app)/setup/onboarding/lib/constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ export const STORAGE_KEY = "onboarding_answers";
66
export const companyDetailsSchema = z.object({
77
legalName: z.string().min(2, "Company name must be at least 2 characters"),
88
website: z.string().url("Please enter a valid URL"),
9+
describe: z
10+
.string()
11+
.min(
12+
1,
13+
"Please provide a brief overview and description of what your company does",
14+
)
15+
.max(300, "Description must be less than 300 characters"),
916
industry: z.string().min(1, "Please select your industry"),
1017
teamSize: z.string().min(1, "Please select your team size"),
1118
software: z.string().min(1, "Please select software you use"),
@@ -27,6 +34,12 @@ export const steps: Step[] = [
2734
question: "What's your company website?",
2835
placeholder: "e.g., https://www.acme.com",
2936
},
37+
{
38+
key: "describe",
39+
question: "Describe your company in a few sentences",
40+
placeholder:
41+
"e.g., We are a software company that builds tools for businesses to manage their employees.",
42+
},
3043
{
3144
key: "industry",
3245
question: "What industry is your company in?",

apps/app/src/app/[locale]/(app)/setup/onboarding/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type CompanyDetails = {
22
legalName: string;
33
website: string;
4+
describe: string;
45
industry: string;
56
teamSize: string;
67
devices: string;

apps/app/src/jobs/tasks/scrape/research.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,28 @@ export const researchVendor = schemaTask({
4040
}),
4141
maxDuration: 1000 * 60 * 10, // 10 minutes total task duration
4242
run: async (payload, { ctx }) => {
43+
// Check if vendor already exists
44+
const existingVendor = await db.globalVendors.findFirst({
45+
where: {
46+
OR: [
47+
{ website: payload.website },
48+
{
49+
company_name: {
50+
equals: payload.website,
51+
mode: "insensitive",
52+
},
53+
},
54+
],
55+
},
56+
});
57+
58+
if (existingVendor) {
59+
return {
60+
message: "Vendor already exists in database",
61+
existingVendor,
62+
};
63+
}
64+
4365
return researchJobCore({
4466
website: payload.website,
4567
prompt: "You're a cyber security researcher, researching a vendor.",

0 commit comments

Comments
 (0)