forked from Yara724/api
Added vin inquiry for v6, fixed new damaged part for v4
This commit is contained in:
@@ -22,6 +22,12 @@ export const OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5 = [
|
||||
"guilty_metal_plate",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Extra capture-phase document key present only in V4/V5 (FileMaker) flows.
|
||||
* Uploaded via `upload-document` after all car angles are captured.
|
||||
*/
|
||||
export const GUILTY_DAMAGE_AREA_DOC_KEY = "guilty_damage_area" as const;
|
||||
|
||||
export type CapturePhaseSequence =
|
||||
| "parts"
|
||||
| "angles"
|
||||
@@ -58,7 +64,12 @@ function isRequiredDocumentUploadedOnClaim(
|
||||
|
||||
export function getClaimCaptureProgress(
|
||||
claimCase: any,
|
||||
options?: { assumeCapturePhaseDocKey?: string; skipMetalPlate?: boolean },
|
||||
options?: {
|
||||
assumeCapturePhaseDocKey?: string;
|
||||
skipMetalPlate?: boolean;
|
||||
/** V4/V5 only — include `guilty_damage_area` in capture-phase doc count. */
|
||||
includeGuiltyDamageArea?: boolean;
|
||||
},
|
||||
): ClaimCaptureProgress {
|
||||
const carType = claimCase?.vehicle?.carType as ClaimVehicleTypeV2 | undefined;
|
||||
const selectedNorm = normalizeDamageSelectedParts(
|
||||
@@ -87,13 +98,15 @@ export function getClaimCaptureProgress(
|
||||
const anglesTotal = CLAIM_CAR_ANGLE_KEYS.length;
|
||||
const anglesComplete = anglesCaptured >= anglesTotal;
|
||||
|
||||
const capturePhaseDocsRemaining = CAPTURE_PHASE_DAMAGED_PARTY_DOC_KEYS.filter(
|
||||
(k) => {
|
||||
if (options?.skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(k as any)) return false;
|
||||
if (k === options?.assumeCapturePhaseDocKey) return false;
|
||||
return !isRequiredDocumentUploadedOnClaim(claimCase, k);
|
||||
},
|
||||
).length;
|
||||
const capturePhaseKeys: string[] = [
|
||||
...CAPTURE_PHASE_DAMAGED_PARTY_DOC_KEYS,
|
||||
...(options?.includeGuiltyDamageArea ? [GUILTY_DAMAGE_AREA_DOC_KEY] : []),
|
||||
];
|
||||
const capturePhaseDocsRemaining = capturePhaseKeys.filter((k) => {
|
||||
if (options?.skipMetalPlate && OPTIONAL_CAPTURE_PHASE_DOC_KEYS_V4V5.includes(k as any)) return false;
|
||||
if (k === options?.assumeCapturePhaseDocKey) return false;
|
||||
return !isRequiredDocumentUploadedOnClaim(claimCase, k);
|
||||
}).length;
|
||||
const capturePhaseDocsComplete = capturePhaseDocsRemaining === 0;
|
||||
|
||||
let sequencePhase: CapturePhaseSequence = "parts";
|
||||
|
||||
Reference in New Issue
Block a user