Skip to content

Commit 334063a

Browse files
HarshHarsh
authored andcommitted
fix build error
1 parent 532e04b commit 334063a

File tree

11 files changed

+87
-46
lines changed

11 files changed

+87
-46
lines changed

Clients/src/application/repository/intakeForm.repository.ts

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
IntakeEntityType,
55
IntakeSubmissionStatus,
66
} from "../../domain/intake/enums";
7+
import type { FieldType, FormDesignSettings } from "../../presentation/pages/IntakeFormBuilder/types";
78

89
// Re-export enums for convenience
910
export { IntakeFormStatus, IntakeEntityType, IntakeSubmissionStatus };
@@ -39,7 +40,7 @@ export interface FieldValidation {
3940
*/
4041
export interface FormField {
4142
id: string;
42-
type: string;
43+
type: FieldType;
4344
label: string;
4445
placeholder?: string;
4546
helpText?: string;
@@ -78,7 +79,7 @@ export interface IntakeForm {
7879
riskAssessmentConfig?: Record<string, unknown> | null;
7980
llmKeyId?: number | null;
8081
suggestedQuestionsEnabled?: boolean;
81-
designSettings?: Record<string, unknown> | null;
82+
designSettings?: FormDesignSettings | null;
8283
createdBy: number;
8384
createdAt: Date;
8485
updatedAt: Date;
@@ -165,7 +166,7 @@ export async function getAllIntakeForms(
165166

166167
const url = `${BASE_URL}/forms${queryParams.toString() ? `?${queryParams}` : ""}`;
167168
const response = await apiServices.get(url, { signal });
168-
return response.data;
169+
return response.data as { data: IntakeForm[]; pagination?: { total: number; page: number; limit: number } };
169170
}
170171

171172
/**
@@ -176,7 +177,7 @@ export async function getIntakeForm(
176177
signal?: AbortSignal
177178
): Promise<{ data: IntakeForm }> {
178179
const response = await apiServices.get(`${BASE_URL}/forms/${formId}`, { signal });
179-
return response.data;
180+
return response.data as { data: IntakeForm };
180181
}
181182

182183
/**
@@ -196,12 +197,12 @@ export async function createIntakeForm(
196197
riskTierSystem?: string;
197198
llmKeyId?: number | null;
198199
suggestedQuestionsEnabled?: boolean;
199-
designSettings?: Record<string, unknown> | null;
200+
designSettings?: FormDesignSettings | null;
200201
},
201202
signal?: AbortSignal
202203
): Promise<{ data: IntakeForm }> {
203204
const response = await apiServices.post(`${BASE_URL}/forms`, data, { signal });
204-
return response.data;
205+
return response.data as { data: IntakeForm };
205206
}
206207

207208
/**
@@ -221,12 +222,12 @@ export async function updateIntakeForm(
221222
riskTierSystem?: string;
222223
llmKeyId?: number | null;
223224
suggestedQuestionsEnabled?: boolean;
224-
designSettings?: Record<string, unknown> | null;
225+
designSettings?: FormDesignSettings | null;
225226
},
226227
signal?: AbortSignal
227228
): Promise<{ data: IntakeForm }> {
228229
const response = await apiServices.patch(`${BASE_URL}/forms/${formId}`, data, { signal });
229-
return response.data;
230+
return response.data as { data: IntakeForm };
230231
}
231232

232233
/**
@@ -237,7 +238,7 @@ export async function deleteIntakeForm(
237238
signal?: AbortSignal
238239
): Promise<{ data: null }> {
239240
const response = await apiServices.delete(`${BASE_URL}/forms/${formId}`, { signal });
240-
return response.data;
241+
return response.data as { data: null };
241242
}
242243

243244
/**
@@ -248,7 +249,7 @@ export async function archiveIntakeForm(
248249
signal?: AbortSignal
249250
): Promise<{ data: IntakeForm }> {
250251
const response = await apiServices.post(`${BASE_URL}/forms/${formId}/archive`, undefined, { signal });
251-
return response.data;
252+
return response.data as { data: IntakeForm };
252253
}
253254

254255
// ============================================================================
@@ -273,7 +274,7 @@ export async function getPendingSubmissions(
273274

274275
const url = `${BASE_URL}/submissions${queryParams.toString() ? `?${queryParams}` : ""}`;
275276
const response = await apiServices.get(url, { signal });
276-
return response.data;
277+
return response.data as { data: IntakeSubmission[]; pagination?: { total: number; page: number; limit: number } };
277278
}
278279

279280
/**
@@ -299,7 +300,22 @@ export async function getSubmissionPreview(
299300
};
300301
}> {
301302
const response = await apiServices.get(`${BASE_URL}/submissions/${submissionId}/preview`, { signal });
302-
return response.data;
303+
return response.data as {
304+
data: {
305+
submission: IntakeSubmission;
306+
riskAssessment: RiskAssessment | null;
307+
entityPreview: Record<string, unknown>;
308+
form: {
309+
id: number;
310+
name: string;
311+
entityType: string;
312+
schema: FormSchema;
313+
riskTierSystem?: string;
314+
};
315+
riskTier?: string | null;
316+
riskOverride?: RiskOverride | null;
317+
};
318+
};
303319
}
304320

305321
/**
@@ -322,7 +338,7 @@ export async function approveSubmission(
322338
data || {},
323339
{ signal }
324340
);
325-
return response.data;
341+
return response.data as { data: { submission: IntakeSubmission; createdEntity: unknown } };
326342
}
327343

328344
/**
@@ -338,7 +354,7 @@ export async function rejectSubmission(
338354
{ reason },
339355
{ signal }
340356
);
341-
return response.data;
357+
return response.data as { data: IntakeSubmission };
342358
}
343359

344360
// ============================================================================
@@ -350,7 +366,7 @@ export async function rejectSubmission(
350366
*/
351367
export async function getCaptcha(): Promise<{ data: { question: string; token: string } }> {
352368
const response = await apiServices.get(`${BASE_URL}/public/captcha`);
353-
return response.data;
369+
return response.data as { data: { question: string; token: string } };
354370
}
355371

356372
/**
@@ -370,7 +386,7 @@ export async function getPublicForm(
370386
entityType: IntakeEntityType;
371387
schema: FormSchema;
372388
submitButtonText: string;
373-
designSettings?: Record<string, unknown> | null;
389+
designSettings?: FormDesignSettings | null;
374390
};
375391
previousData?: Record<string, unknown>;
376392
previousSubmitterName?: string;
@@ -379,7 +395,23 @@ export async function getPublicForm(
379395
}> {
380396
const queryParams = resubmissionToken ? `?token=${resubmissionToken}` : "";
381397
const response = await apiServices.get(`${BASE_URL}/public/${tenantSlug}/${formSlug}${queryParams}`);
382-
return response.data;
398+
return response.data as {
399+
data: {
400+
form: {
401+
id: number;
402+
name: string;
403+
description: string;
404+
slug: string;
405+
entityType: IntakeEntityType;
406+
schema: FormSchema;
407+
submitButtonText: string;
408+
designSettings?: FormDesignSettings | null;
409+
};
410+
previousData?: Record<string, unknown>;
411+
previousSubmitterName?: string;
412+
previousSubmitterEmail?: string;
413+
};
414+
};
383415
}
384416

385417
/**
@@ -404,7 +436,7 @@ export async function submitPublicForm(
404436
};
405437
}> {
406438
const response = await apiServices.post(`${BASE_URL}/public/${tenantSlug}/${formSlug}`, data);
407-
return response.data;
439+
return response.data as { data: { submissionId: number; resubmissionToken: string; message: string } };
408440
}
409441

410442
/**
@@ -423,7 +455,7 @@ export async function getPublicFormById(
423455
entityType: IntakeEntityType;
424456
schema: FormSchema;
425457
submitButtonText: string;
426-
designSettings?: Record<string, unknown> | null;
458+
designSettings?: FormDesignSettings | null;
427459
};
428460
previousData?: Record<string, unknown>;
429461
previousSubmitterName?: string;
@@ -432,7 +464,23 @@ export async function getPublicFormById(
432464
}> {
433465
const queryParams = resubmissionToken ? `?token=${resubmissionToken}` : "";
434466
const response = await apiServices.get(`${BASE_URL}/public/by-id/${publicId}${queryParams}`);
435-
return response.data;
467+
return response.data as {
468+
data: {
469+
form: {
470+
id: number;
471+
name: string;
472+
description: string;
473+
slug: string;
474+
entityType: IntakeEntityType;
475+
schema: FormSchema;
476+
submitButtonText: string;
477+
designSettings?: FormDesignSettings | null;
478+
};
479+
previousData?: Record<string, unknown>;
480+
previousSubmitterName?: string;
481+
previousSubmitterEmail?: string;
482+
};
483+
};
436484
}
437485

438486
// ============================================================================
@@ -460,5 +508,5 @@ export async function submitPublicFormById(
460508
};
461509
}> {
462510
const response = await apiServices.post(`${BASE_URL}/public/by-id/${publicId}`, data);
463-
return response.data;
511+
return response.data as { data: { submissionId: number; resubmissionToken: string; message: string } };
464512
}

Clients/src/presentation/components/EntityLinkSelector/index.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ const ENTITY_TYPE_OPTIONS = [
2929
{ _id: "framework", name: "Framework (Organizational)" },
3030
];
3131

32-
// Framework ID to entity type mapping
33-
const FRAMEWORK_ENTITY_TYPE_MAP: Record<number, { subclauses: EntityType; annexes?: EntityType }> = {
34-
1: { subclauses: "eu_control" }, // EU AI Act - controls
35-
2: { subclauses: "iso42001_subclause", annexes: "iso42001_annexcategory" }, // ISO 42001
36-
3: { subclauses: "iso27001_subclause", annexes: "iso27001_annexcontrol" }, // ISO 27001
37-
4: { subclauses: "nist_subcategory" }, // NIST AI RMF
38-
};
39-
4032
const EntityLinkSelector: React.FC<EntityLinkSelectorProps> = ({
4133
value = [],
4234
onChange,
@@ -48,7 +40,6 @@ const EntityLinkSelector: React.FC<EntityLinkSelectorProps> = ({
4840
const [selectedTopLevel, setSelectedTopLevel] = useState<string>("");
4941
const [selectedProject, setSelectedProject] = useState<number | "">("");
5042
const [selectedFramework, setSelectedFramework] = useState<number | "">("");
51-
const [selectedSubEntityType, setSelectedSubEntityType] = useState<string>("");
5243
const [selectedEntityId, setSelectedEntityId] = useState<number | "">("");
5344

5445
// Data states

Clients/src/presentation/pages/IntakeFormBuilder/DesignPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export function DesignPanel({ settings, onChange }: DesignPanelProps) {
394394
id="design-font-inline"
395395
label=""
396396
value={s.fontFamily}
397-
onChange={(e) => update({ fontFamily: e.target.value })}
397+
onChange={(e) => update({ fontFamily: String(e.target.value) })}
398398
items={FONT_OPTIONS}
399399
sx={{
400400
"& .MuiOutlinedInput-root": {

Clients/src/presentation/pages/IntakeFormBuilder/FieldEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ interface FieldEditorProps {
139139
export function FieldEditor({ field, entityType, usedEntityMappings = [], onChange, onClose }: FieldEditorProps) {
140140
const theme = useTheme();
141141
const [localField, setLocalField] = useState<FormField>(field);
142-
const debounceTimerRef = useRef<ReturnType<typeof setTimeout>>();
142+
const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
143143

144144
// Clear pending debounce when field changes to prevent stale updates
145145
useEffect(() => {

Clients/src/presentation/pages/IntakeFormBuilder/IntakeFormsListPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export function IntakeFormsListPage() {
495495
<TableCell sx={singleTheme.tableStyles.primary.body.cell} onClick={(e) => e.stopPropagation()}>
496496
<IconButton
497497
disableRipple={
498-
theme.components?.IconButton?.defaultProps?.disableRipple
498+
theme.components?.MuiIconButton?.defaultProps?.disableRipple
499499
}
500500
sx={singleTheme.iconButtons}
501501
onClick={(e) => handleMenuOpen(e, form)}

Clients/src/presentation/pages/IntakeFormBuilder/SubmissionPreviewModal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ function OverrideSection({
186186
value={overrideJustification}
187187
onChange={(e) => onJustificationChange(e.target.value)}
188188
rows={2}
189-
error={overrideJustification.length > 0 && overrideJustification.length < 10}
190-
helperText={
189+
error={
191190
overrideJustification.length > 0 && overrideJustification.length < 10
192191
? "Justification must be at least 10 characters"
193192
: undefined

Clients/src/presentation/pages/IntakeFormBuilder/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import { DesignPanel } from "./DesignPanel";
4343
import CustomizableMultiSelect from "../../components/Inputs/Select/Multi";
4444
import {
4545
FormField,
46-
FormDesignSettings,
4746
IntakeForm,
4847
createEmptyForm,
4948
generateFieldId,

Clients/src/presentation/pages/IntakeFormBuilder/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export interface IntakeForm {
103103
riskAssessmentConfig?: Record<string, unknown> | null;
104104
llmKeyId?: number | null;
105105
suggestedQuestionsEnabled?: boolean;
106-
designSettings?: FormDesignSettings;
106+
designSettings?: FormDesignSettings | null;
107107
createdBy?: number;
108108
createdAt?: Date;
109109
updatedAt?: Date;
@@ -125,7 +125,7 @@ export interface CreateIntakeFormInput {
125125
riskTierSystem?: string;
126126
llmKeyId?: number | null;
127127
suggestedQuestionsEnabled?: boolean;
128-
designSettings?: FormDesignSettings;
128+
designSettings?: FormDesignSettings | null;
129129
}
130130

131131
/**
@@ -143,7 +143,7 @@ export interface UpdateIntakeFormInput {
143143
riskTierSystem?: string;
144144
llmKeyId?: number | null;
145145
suggestedQuestionsEnabled?: boolean;
146-
designSettings?: FormDesignSettings;
146+
designSettings?: FormDesignSettings | null;
147147
}
148148

149149
/**

Clients/src/presentation/pages/PublicIntakeForm/FormFieldRenderer.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ export function FormFieldRenderer({ field, control, errors }: FormFieldRendererP
123123
id={`field-${field.id}`}
124124
label=""
125125
{...fieldProps}
126+
value={fieldProps.value as string}
126127
placeholder={field.placeholder}
127128
type={field.type === "email" ? "email" : field.type === "url" ? "url" : "text"}
128-
error={!!error}
129+
error={errorMessage}
129130
helperText={errorMessage || field.helpText}
130131
/>
131132
<GuidanceText text={field.guidanceText} />
@@ -158,9 +159,10 @@ export function FormFieldRenderer({ field, control, errors }: FormFieldRendererP
158159
id={`field-${field.id}`}
159160
label=""
160161
{...fieldProps}
162+
value={fieldProps.value as string}
161163
placeholder={field.placeholder}
162164
rows={4}
163-
error={!!error}
165+
error={errorMessage}
164166
helperText={errorMessage || field.helpText}
165167
/>
166168
<GuidanceText text={field.guidanceText} />
@@ -193,9 +195,10 @@ export function FormFieldRenderer({ field, control, errors }: FormFieldRendererP
193195
id={`field-${field.id}`}
194196
label=""
195197
{...fieldProps}
198+
value={fieldProps.value as string | number}
196199
type="number"
197200
placeholder={field.placeholder}
198-
error={!!error}
201+
error={errorMessage}
199202
helperText={errorMessage || field.helpText}
200203
/>
201204
<GuidanceText text={field.guidanceText} />
@@ -222,8 +225,9 @@ export function FormFieldRenderer({ field, control, errors }: FormFieldRendererP
222225
id={`field-${field.id}`}
223226
label=""
224227
{...fieldProps}
228+
value={fieldProps.value as string}
225229
type="date"
226-
error={!!error}
230+
error={errorMessage}
227231
helperText={errorMessage || field.helpText}
228232
/>
229233
<GuidanceText text={field.guidanceText} />

Clients/src/presentation/pages/PublicIntakeForm/MathCaptcha.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function MathCaptcha({ value, onChange, error, refreshTrigger }: MathCapt
116116
placeholder="?"
117117
type="number"
118118
disabled={isLoading}
119-
error={!!error}
119+
error={error}
120120
sx={{
121121
width: 80,
122122
"& .MuiOutlinedInput-root": {

0 commit comments

Comments
 (0)