Merge pull request #3249 from Safelite/nation/CASH-2844

Nation/cash 2844
This commit is contained in:
CarlNation 2026-07-02 08:17:52 -04:00 committed by GitHub
commit 0e119272f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 76 deletions

View file

@ -78,13 +78,3 @@ export function coverageTypeEnum(strCoverageType) {
return null; return null;
} }
} }
export const parentAccountNumbers = {
CONNECT: "560636",
};
export const PARENT_ACCOUNT_NUMBERS = {
STATE_FARM: "711310",
USAA: "900040",
GEICO: "250034",
};

View file

@ -131,6 +131,10 @@ export default {
}, },
validationRules: String, validationRules: String,
cmsWidgetName: String, cmsWidgetName: String,
overrideQuestionText: {
type: String,
default: "",
},
maxLength: String, maxLength: String,
questionAlignment: String, // Left or center. Left is default. questionAlignment: String, // Left or center. Left is default.
cornerStyle: String, // Rounded or square. Square is default. cornerStyle: String, // Rounded or square. Square is default.
@ -222,9 +226,9 @@ export default {
}, },
computed: { computed: {
questionText() { questionText() {
return this.addOptionalText const baseText =
? this.getCmsContent(this.cmsWidgetName, "QuestionText") + " (optional)" this.overrideQuestionText || this.getCmsContent(this.cmsWidgetName, "QuestionText");
: this.getCmsContent(this.cmsWidgetName, "QuestionText"); return this.addOptionalText ? baseText + " (optional)" : baseText;
}, },
value: { value: {
get: function () { get: function () {

View file

@ -13,17 +13,6 @@
<script> <script>
import buttonQuestion from "@/digital-components/button-question/button-question"; import buttonQuestion from "@/digital-components/button-question/button-question";
import store from "@/store";
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 { export default {
name: "morePolicyQuestions", name: "morePolicyQuestions",
@ -39,40 +28,10 @@ export default {
answersFromCms() { answersFromCms() {
return this.getCmsContent(this.cmsWidgetName, "Answers"); return this.getCmsContent(this.cmsWidgetName, "Answers");
}, },
isStateFarm() {
return (
store.getters.order?.payment?.parentAccountNumber?.toString() ===
PARENT_ACCOUNT_NUMBERS.STATE_FARM
);
},
stateFarmTextOverrides() {
return Object.fromEntries(
Object.entries(STATE_FARM_TEXT_OVERRIDES).map(([name, widget]) => [
name,
this.getCmsContent(widget, "Text"),
])
);
},
answersToDisplay() { answersToDisplay() {
if (!Array.isArray(this.answersFromCms)) return []; if (!Array.isArray(this.answersFromCms)) return [];
return this.answersFromCms 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: { selectedValues: {
get() { get() {

View file

@ -17,7 +17,8 @@
<textboxQuestion <textboxQuestion
isRequired isRequired
class="mb-1" class="mb-1"
:cmsWidgetName="policyNumberWidgetName" cmsWidgetName="PolicyNumberWidget"
:overrideQuestionText="policyNumberLabelOverride"
v-model="policyNumber" v-model="policyNumber"
inputId="policyNumber" inputId="policyNumber"
validationRules="policy-number-required" /> validationRules="policy-number-required" />
@ -179,7 +180,7 @@
<morePolicyQuestions <morePolicyQuestions
ref="morePolicyQuestions" ref="morePolicyQuestions"
cmsWidgetName="MorePolicyQuestionsWidget" :cmsWidgetName="morePolicyQuestionsWidgetName"
v-model="morePolicyQuestions" v-model="morePolicyQuestions"
groupName="MorePolicyQuestionsQuestion" /> groupName="MorePolicyQuestionsQuestion" />
@ -215,7 +216,6 @@ import { Form, defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules"; import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import { regex } from "@/helpers/validation-rules"; import { regex } from "@/helpers/validation-rules";
import { PARENT_ACCOUNT_NUMBERS } from "@/constants/insurance";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
@ -287,15 +287,8 @@ export default {
subHeaderSubTextOverride() { subHeaderSubTextOverride() {
return this.clientConfig?.PageInstructionsOverrideWidget?.Text || ""; return this.clientConfig?.PageInstructionsOverrideWidget?.Text || "";
}, },
isUSAA() { policyNumberLabelOverride() {
return ( return this.clientConfig?.PolicyNumberLabelOverrideWidget?.Text || "";
store.getters.order?.payment?.parentAccountNumber?.toString() ===
PARENT_ACCOUNT_NUMBERS.USAA
);
},
policyNumberWidgetName() {
console.log("isUSAA", this.isUSAA);
return this.isUSAA ? "PolicyNumberUSAAWidget" : "PolicyNumberWidget";
}, },
policyHelperText() { policyHelperText() {
return this.clientConfig?.PolicyHelperTextOverrideWidget?.Text; return this.clientConfig?.PolicyHelperTextOverrideWidget?.Text;
@ -391,6 +384,12 @@ export default {
lossLocationQuestionText() { lossLocationQuestionText() {
return this.getCmsContent("LossLocationQuestionWidget", "QuestionText"); return this.getCmsContent("LossLocationQuestionWidget", "QuestionText");
}, },
morePolicyQuestionsWidgetName() {
// State Farm may be the only one who uses this
return this.parsedClientConfig.OverrideMorePolicyQuestions
? "MorePolicyQuestionsOverrideWidget"
: "MorePolicyQuestionsWidget";
},
}, },
// Ensure CMS content is fetched during route navigation without depending on `to`/`from` // Ensure CMS content is fetched during route navigation without depending on `to`/`from`
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {

View file

@ -83,7 +83,6 @@ import { Form, defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules"; import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import { regex } from "@/helpers/validation-rules"; import { regex } from "@/helpers/validation-rules";
import { PARENT_ACCOUNT_NUMBERS } from "@/constants/insurance";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
@ -162,14 +161,8 @@ export default {
return {}; return {};
} }
}, },
isGeico() {
return (
store.getters.order?.payment?.parentAccountNumber?.toString() ===
PARENT_ACCOUNT_NUMBERS.GEICO
);
},
displayDateOfBirth() { displayDateOfBirth() {
return this.parsedClientConfig.displayDateOfBirth && this.isGeico ? true : false; return this.parsedClientConfig.displayDateOfBirth ?? false;
}, },
}, },