forked from Yara724/api
status modfied
This commit is contained in:
@@ -3,6 +3,8 @@ import { ClaimStatus } from "src/Types&Enums/claim-request-management/claimStatu
|
||||
import { ClaimWorkflowStep } from "src/Types&Enums/claim-request-management/claim-workflow-steps.enum";
|
||||
import {
|
||||
classifyV2ExpertPricingParts,
|
||||
claimCaseStatusAllowsOwnerInsurerSignStep,
|
||||
claimCaseStatusIsV2OwnerPostExpertPipeline,
|
||||
getActiveV2ExpertReply,
|
||||
objectionDisallowedDueToOutstandingFactorWorkflow,
|
||||
} from "src/helpers/claim-v2-expert-reply-workflow";
|
||||
@@ -46,7 +48,7 @@ function objectionWindowForOwner(claim: any): {
|
||||
|
||||
let pricingEligible = false;
|
||||
if (
|
||||
claim.status === ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL &&
|
||||
claimCaseStatusAllowsOwnerInsurerSignStep(claim.status) &&
|
||||
claim.workflow?.currentStep === ClaimWorkflowStep.INSURER_REVIEW &&
|
||||
!claim.evaluation?.ownerInsurerApproval?.signedAt
|
||||
) {
|
||||
@@ -191,7 +193,7 @@ export function buildClaimDetailsV2OwnerGuidance(
|
||||
};
|
||||
}
|
||||
|
||||
if (claim.status !== ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL) {
|
||||
if (!claimCaseStatusIsV2OwnerPostExpertPipeline(claim.status)) {
|
||||
return {
|
||||
phaseKey: "USER_FLOW",
|
||||
headline: "Continue your claim registration",
|
||||
|
||||
@@ -40,6 +40,72 @@ export function classifyV2ExpertPricingParts(parts: ClaimPricingPartLite[]) {
|
||||
};
|
||||
}
|
||||
|
||||
const OWNER_POST_EXPERT_INSURER_SIGNATURE_STATUSES: ReadonlySet<string> = new Set([
|
||||
ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL,
|
||||
ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN,
|
||||
ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING,
|
||||
]);
|
||||
|
||||
const OWNER_FACTOR_UPLOAD_PHASE_STATUSES: ReadonlySet<string> = new Set([
|
||||
ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL,
|
||||
ClaimCaseStatus.OWNER_REPAIR_FACTOR_UPLOAD_PENDING,
|
||||
ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING,
|
||||
]);
|
||||
|
||||
const V2_POST_EXPERT_OWNER_PIPELINE_STATUSES: ReadonlySet<string> = new Set([
|
||||
ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL,
|
||||
ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN,
|
||||
ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING,
|
||||
ClaimCaseStatus.OWNER_REPAIR_FACTOR_UPLOAD_PENDING,
|
||||
ClaimCaseStatus.EXPERT_VALIDATING_REPAIR_FACTORS,
|
||||
]);
|
||||
|
||||
/** Owner multipart sign at `INSURER_REVIEW` (priced-line gate or final acceptance). */
|
||||
export function claimCaseStatusAllowsOwnerInsurerSignStep(
|
||||
status: ClaimCaseStatus | string | undefined,
|
||||
): boolean {
|
||||
return OWNER_POST_EXPERT_INSURER_SIGNATURE_STATUSES.has(String(status ?? ""));
|
||||
}
|
||||
|
||||
/** Repair-factor upload during `NEEDS_REVISION` @ `OWNER_UPLOAD_FACTOR_DOCUMENTS`. */
|
||||
export function claimCaseStatusAllowsOwnerFactorUploadDuringRevision(
|
||||
status: ClaimCaseStatus | string | undefined,
|
||||
): boolean {
|
||||
return OWNER_FACTOR_UPLOAD_PHASE_STATUSES.has(String(status ?? ""));
|
||||
}
|
||||
|
||||
/** Owner-facing post-expert flow: signatures, factor uploads, or waiting on expert factor validation. */
|
||||
export function claimCaseStatusIsV2OwnerPostExpertPipeline(
|
||||
status: ClaimCaseStatus | string | undefined,
|
||||
): boolean {
|
||||
return V2_POST_EXPERT_OWNER_PIPELINE_STATUSES.has(String(status ?? ""));
|
||||
}
|
||||
|
||||
export function claimIsAwaitingExpertFactorValidationV2(claim: {
|
||||
status?: ClaimCaseStatus | string;
|
||||
claimStatus?: ClaimStatus;
|
||||
workflow?: { currentStep?: string };
|
||||
}): boolean {
|
||||
return (
|
||||
claim.claimStatus === ClaimStatus.UNDER_REVIEW &&
|
||||
claim.workflow?.currentStep === ClaimWorkflowStep.EXPERT_COST_EVALUATION &&
|
||||
(claim.status === ClaimCaseStatus.EXPERT_VALIDATING_REPAIR_FACTORS ||
|
||||
claim.status === ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL)
|
||||
);
|
||||
}
|
||||
|
||||
export function claimCaseStatusAfterExpertReplyV2(parts: ClaimPricingPartLite[]): ClaimCaseStatus {
|
||||
const { mixedFactorAndPrice } = classifyV2ExpertPricingParts(parts);
|
||||
const needsFactorUpload = parts.some((p) => p.factorNeeded === true);
|
||||
if (!needsFactorUpload) {
|
||||
return ClaimCaseStatus.INSURER_REVIEW_AWAITING_OWNER_SIGN;
|
||||
}
|
||||
if (mixedFactorAndPrice) {
|
||||
return ClaimCaseStatus.INSURER_REVIEW_MIXED_FACTORS_PENDING;
|
||||
}
|
||||
return ClaimCaseStatus.OWNER_REPAIR_FACTOR_UPLOAD_PENDING;
|
||||
}
|
||||
|
||||
export function claimIsV2ExpertFactorUploadStep(claim: { workflow?: { currentStep?: string } }) {
|
||||
return claim.workflow?.currentStep === ClaimWorkflowStep.OWNER_UPLOAD_FACTOR_DOCUMENTS;
|
||||
}
|
||||
@@ -49,11 +115,7 @@ export function claimIsV2PendingFactorExpertValidation(claim: {
|
||||
claimStatus?: ClaimStatus;
|
||||
workflow?: { currentStep?: string };
|
||||
}) {
|
||||
return (
|
||||
claim.status === ClaimCaseStatus.WAITING_FOR_INSURER_APPROVAL &&
|
||||
claim.claimStatus === ClaimStatus.UNDER_REVIEW &&
|
||||
claim.workflow?.currentStep === ClaimWorkflowStep.EXPERT_COST_EVALUATION
|
||||
);
|
||||
return claimIsAwaitingExpertFactorValidationV2(claim);
|
||||
}
|
||||
|
||||
export function objectionDisallowedDueToOutstandingFactorWorkflow(claim: {
|
||||
|
||||
Reference in New Issue
Block a user