Skip to content

Commit fd74000

Browse files
committed
feat: add geo field to onboarding process
- Introduced a new 'geo' field in the onboarding schema and related components to capture data location preferences. - Updated onboarding forms and hooks to handle the new 'geo' field, ensuring consistent data collection across the application.
1 parent 2f7e0e3 commit fd74000

File tree

6 files changed

+49
-20
lines changed

6 files changed

+49
-20
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default async function OnboardingPage({ params }: OnboardingPageProps) {
8787
workLocation: initialData.workLocation || 'Fully remote',
8888
infrastructure: initialData.infrastructure || 'AWS, Vercel',
8989
dataTypes: initialData.dataTypes || 'Employee data',
90+
geo: initialData.geo || 'North America,Europe (EU)',
9091
});
9192
}
9293

apps/app/src/app/(app)/onboarding/actions/complete-onboarding.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const onboardingCompletionSchema = z.object({
2222
workLocation: z.string().min(1),
2323
infrastructure: z.string().min(1),
2424
dataTypes: z.string().min(1),
25+
geo: z.string().min(1),
2526
});
2627

2728
export const completeOnboarding = authActionClient

apps/app/src/app/(app)/onboarding/hooks/usePostPaymentOnboarding.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export function usePostPaymentOnboarding({
138138
workLocation: allAnswers.workLocation || '',
139139
infrastructure: allAnswers.infrastructure || '',
140140
dataTypes: allAnswers.dataTypes || '',
141+
geo: allAnswers.geo || '',
141142
});
142143
};
143144

apps/app/src/app/(app)/setup/lib/constants.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const companyDetailsSchema = z.object({
1919
devices: z.string().min(1, 'Please select device types'),
2020
authentication: z.string().min(1, 'Please select authentication methods'),
2121
workLocation: z.string().min(1, 'Please select work arrangement'),
22+
geo: z.string().min(1, 'Please select where your data is located'),
2223
});
2324

2425
export const steps: Step[] = [
@@ -121,6 +122,21 @@ export const steps: Step[] = [
121122
'Other',
122123
],
123124
},
125+
{
126+
key: 'geo',
127+
question: 'Where is your data located?',
128+
placeholder: 'e.g., North America',
129+
options: [
130+
'North America',
131+
'Europe (EU)',
132+
'United Kingdom',
133+
'Asia-Pacific',
134+
'South America',
135+
'Africa',
136+
'Middle East',
137+
'Australia/New Zealand',
138+
],
139+
},
124140
];
125141

126142
export const welcomeText = [

apps/app/src/app/(app)/setup/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type CompanyDetails = {
1111
infrastructure: string;
1212
dataTypes: string;
1313
software: string;
14+
geo: string;
1415
};
1516

1617
export type ChatBubble = {

apps/app/src/jobs/lib/prompts.ts

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export const generatePrompt = ({
3333
? frameworks.map((f) => `${f.name} v${f.version}`).join(', ')
3434
: 'None explicitly selected';
3535
const hasHIPAA = frameworks.some((f) => f.name.toLowerCase().includes('hipaa'));
36+
const hasSOC2 = frameworks.some(
37+
(f) => /soc\s*2/i.test(f.name) || f.name.toLowerCase().includes('soc'),
38+
);
3639

3740
return `
3841
Company: ${companyName} (${companyWebsite})
@@ -44,31 +47,37 @@ ${contextHub}
4447
Task: Edit the provided TipTap JSON template to produce the final policy TipTap JSON. Apply ONLY the rules below.
4548
4649
Required rules (keep this simple):
47-
1) Framework sections
48-
- The template may contain framework-specific sections titled like "SOC 2 Specific" or "HIPAA Specific".
49-
- Keep only the sections for the selected frameworks. Remove the sections for unselected frameworks.
50-
- For the kept sections, remove the "<Framework> Specific" label and keep their bullets under the appropriate place.
51-
- Consolidate bullets if redundant; do not add new sections.
52-
53-
2) Company details
54-
- If the template asks to insert company info, replace placeholders (e.g., {{COMPANY_NAME}}, {{COMPANY_WEBSITE}}) with: ${companyName}, ${companyWebsite}.
55-
- Only add details where the template asks; do not invent new fields.
5650
57-
3) Vendors (keep focused)
58-
- Mention only vendors/tools that are critical or high-impact for this policy.
59-
- Do not invent vendors.
60-
${
61-
hasHIPAA
62-
? ` - If HIPAA is selected, inline-tag vendors when relevant: (criticality: high|medium|low; data: PHI|PII when applicable). No separate Vendors table.`
63-
: ''
64-
}
51+
1) Company details
52+
- If the template contains placeholders like {{...}}, replace ANY placeholder with information you actually have (from the knowledge base, company name, company website, frameworks context).
53+
- If a specific placeholder cannot be resolved, set it to "N/A" (do not invent values).
54+
- Only fill placeholders where the template asks; do not add new fields beyond the placeholders.
55+
- Placeholder legend (map values from the knowledge base Q&A where available):
56+
- {{COMPANY}} ⇐ Company Name
57+
- {{COMPANYINFO}} ⇐ Describe your company in a few sentences
58+
- {{INDUSTRY}} ⇐ What Industry is your company in?
59+
- {{EMPLOYEES}} ⇐ How many employees do you have
60+
- {{DEVICES}} ⇐ What Devices do your team members use
61+
- {{SOFTWARE}} ⇐ What software do you use
62+
- {{LOCATION}} ⇐ How does your team work
63+
- {{CRITICAL}} ⇐ Where do you host your application and data
64+
- {{DATA}} ⇐ What type of data do you handle
65+
- {{GEO}} ⇐ Where is your data located
66+
- If multiple answers exist, choose the most specific/concise form. If no answer is found for a placeholder, set it to "N/A".
6567
66-
4) Structure & style
68+
2) Structure & style
6769
- Keep the same section order and general layout as the template (headings or bold titles as-is).
68-
- No Table of Contents. No control/criteria mapping section unless it already exists in the template.
69-
- Use concise, mandatory language (must/shall) with clear owners/cadences when appropriate.
7070
- Do NOT copy instruction cue lines (e.g., "Add a HIPAA checklist...", "State that...", "Clarify that..."). Convert such cues into real policy language, and then remove the cue line entirely. If a cue precedes bullet points, keep the bullets but delete the cue line.
7171
72+
3) Handlebars-style conditionals
73+
- The template may contain conditional blocks using {{#if var}}...{{/if}} syntax (e.g., {{#if soc2}}, {{#if hipaa}}).
74+
- Evaluate these using the selected frameworks:
75+
- soc2 is ${hasSOC2 ? 'true' : 'false'}
76+
- hipaa is ${hasHIPAA ? 'true' : 'false'}
77+
- If the condition is true: keep only the inner content and remove the {{#if}}/{{/if}} markers.
78+
- If the condition is false: remove the entire block including its content.
79+
- For any other unknown {{#if X}} variables: assume false and remove the block.
80+
7281
Output: Return ONLY the final TipTap JSON document.
7382
7483
Template (TipTap JSON) to edit:

0 commit comments

Comments
 (0)