CASH-2468 customizations

CASH-2468 customizations
This commit is contained in:
CarlNation 2026-05-11 13:56:22 -04:00
parent df3cdebf2e
commit 35c1b1d650
4 changed files with 68 additions and 12 deletions

View file

@ -85,4 +85,5 @@ export const NON_MANAGED_SHOW_CLAIM_NUMBER_PARENTS = [
export const PARENT_ACCOUNT_NUMBERS = {
STATE_FARM: "711310",
USAA: "900040",
};

View file

@ -182,7 +182,7 @@ export default {
await this.dispatchStoreAction(
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
this.selectedAccount.parentAccountNumber.toString(),
Number(this.selectedAccount.parentAccountNumber).toString(),
false
);

View file

@ -18,6 +18,12 @@ import { PARENT_ACCOUNT_NUMBERS } from "@/constants/insurance";
const STATE_FARM_ONLY_ANSWER_NAMES = new Set(["ThirdPartyVehicle", "Injuries"]);
const HIDDEN_FOR_STATE_FARM_ANSWER_NAMES = new Set(["OtherResponsibleParty"]);
// Maps an answer's Name to the CMS widget that supplies a State Farm-specific
// label override. The widget's "Text" property replaces the answer's Text.
const STATE_FARM_TEXT_OVERRIDES = {
AdditionalDamage: "AdditionalDamageStateFarmWidget",
Rental: "RentalStateFarmWidget",
};
export default {
name: "morePolicyQuestions",
@ -39,17 +45,34 @@ export default {
PARENT_ACCOUNT_NUMBERS.STATE_FARM
);
},
stateFarmTextOverrides() {
return Object.fromEntries(
Object.entries(STATE_FARM_TEXT_OVERRIDES).map(([name, widget]) => [
name,
this.getCmsContent(widget, "Text"),
])
);
},
answersToDisplay() {
if (!Array.isArray(this.answersFromCms)) return [];
return this.answersFromCms.filter((ans) => {
if (STATE_FARM_ONLY_ANSWER_NAMES.has(ans?.Name)) {
return this.isStateFarm;
}
if (HIDDEN_FOR_STATE_FARM_ANSWER_NAMES.has(ans?.Name)) {
return !this.isStateFarm;
}
return true;
});
return this.answersFromCms
.filter((ans) => {
if (STATE_FARM_ONLY_ANSWER_NAMES.has(ans?.Name)) {
return this.isStateFarm;
}
if (HIDDEN_FOR_STATE_FARM_ANSWER_NAMES.has(ans?.Name)) {
return !this.isStateFarm;
}
return true;
})
.map((ans) => {
if (!this.isStateFarm) return ans;
const overrideText = this.stateFarmTextOverrides[ans?.Name];
if (overrideText) {
return { ...ans, Text: overrideText };
}
return ans;
});
},
selectedValues: {
get() {

View file

@ -18,15 +18,17 @@
<textBlock
cmsWidgetName="PageInstructionsWidget"
typeStyle="body"
:customText="pageInstructionsText"
class="mb-5 text-left text-md-left" />
<textboxQuestion
isRequired
class="mb-4"
cmsWidgetName="PolicyNumberWidget"
class="mb-1"
:cmsWidgetName="policyNumberWidgetName"
v-model="policyNumber"
inputId="policyNumber"
validationRules="policy-number-required" />
<span v-if="displayPolicyHelperText" class="d-block mb-5 helper-text" v-html="policyHelperText"></span>
<datePickerPopup
v-if="displayDateOfBirth"
@ -79,6 +81,7 @@
cmsWidgetName="PhoneWidget"
v-model="phoneNumber"
inputId="phoneNumber"
mask="###-###-####"
validationRules="phone-number-required" />
</div>
<div class="col-12 col-md-4">
@ -107,6 +110,7 @@
:preventMinMaxNavigation="true" />
<dropdownQuestion
v-if="displayLossTime"
isRequired
:questionText="timeOfLossQuestionText"
class="mb-4"
@ -210,6 +214,7 @@ import { Form, defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import { regex } from "@/helpers/validation-rules";
import { PARENT_ACCOUNT_NUMBERS } from "@/constants/insurance";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper";
@ -279,6 +284,22 @@ export default {
pageTitleText() {
return this.clientConfig?.PageTitleOverrideWidget?.Text || this.getCmsContent("PageTitleWidget", "Text");
},
pageInstructionsText() {
return this.clientConfig?.PageInstructionsOverrideWidget?.Text || this.getCmsContent("PageInstructionsWidget", "Text");
},
isUSAA() {
return (
store.getters.order?.payment?.parentAccountNumber?.toString() ===
PARENT_ACCOUNT_NUMBERS.USAA
);
},
policyNumberWidgetName() {
console.log("isUSAA", this.isUSAA);
return this.isUSAA ? "PolicyNumberUSAAWidget" : "PolicyNumberWidget";
},
policyHelperText() {
return this.clientConfig?.PolicyHelperTextOverrideWidget?.Text;
},
damageTypesQuestionText() {
return this.getCmsContent("DamageTypesWidget", "QuestionText");
},
@ -349,6 +370,9 @@ export default {
displayLossTime() {
return this.parsedClientConfig.displayLossTime ?? false;
},
displayPolicyHelperText() {
return this.policyHelperText !== null && this.policyHelperText !== "";
},
subrogationQuestionText() {
return this.getCmsContent("SubrogationQuestionWidget", "QuestionText");
},
@ -492,4 +516,12 @@ export default {
color: $gray-600;
line-height: 1.625;
}
.helper-text {
font-size: 14px !important;
font-weight: 400;
color: $gray-600;
line-height: 1.625;
font-style: italic;
}
</style>