Merge pull request #3249 from Safelite/nation/CASH-2844
Nation/cash 2844
This commit is contained in:
commit
0e119272f3
5 changed files with 21 additions and 76 deletions
|
|
@ -78,13 +78,3 @@ export function coverageTypeEnum(strCoverageType) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const parentAccountNumbers = {
|
||||
CONNECT: "560636",
|
||||
};
|
||||
|
||||
export const PARENT_ACCOUNT_NUMBERS = {
|
||||
STATE_FARM: "711310",
|
||||
USAA: "900040",
|
||||
GEICO: "250034",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ export default {
|
|||
},
|
||||
validationRules: String,
|
||||
cmsWidgetName: String,
|
||||
overrideQuestionText: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
maxLength: String,
|
||||
questionAlignment: String, // Left or center. Left is default.
|
||||
cornerStyle: String, // Rounded or square. Square is default.
|
||||
|
|
@ -222,9 +226,9 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
questionText() {
|
||||
return this.addOptionalText
|
||||
? this.getCmsContent(this.cmsWidgetName, "QuestionText") + " (optional)"
|
||||
: this.getCmsContent(this.cmsWidgetName, "QuestionText");
|
||||
const baseText =
|
||||
this.overrideQuestionText || this.getCmsContent(this.cmsWidgetName, "QuestionText");
|
||||
return this.addOptionalText ? baseText + " (optional)" : baseText;
|
||||
},
|
||||
value: {
|
||||
get: function () {
|
||||
|
|
|
|||
|
|
@ -13,17 +13,6 @@
|
|||
|
||||
<script>
|
||||
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 {
|
||||
name: "morePolicyQuestions",
|
||||
|
|
@ -39,40 +28,10 @@ export default {
|
|||
answersFromCms() {
|
||||
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() {
|
||||
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;
|
||||
})
|
||||
.map((ans) => {
|
||||
if (!this.isStateFarm) return ans;
|
||||
const overrideText = this.stateFarmTextOverrides[ans?.Name];
|
||||
if (overrideText) {
|
||||
return { ...ans, Text: overrideText };
|
||||
}
|
||||
return ans;
|
||||
});
|
||||
return this.answersFromCms;
|
||||
},
|
||||
selectedValues: {
|
||||
get() {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
<textboxQuestion
|
||||
isRequired
|
||||
class="mb-1"
|
||||
:cmsWidgetName="policyNumberWidgetName"
|
||||
cmsWidgetName="PolicyNumberWidget"
|
||||
:overrideQuestionText="policyNumberLabelOverride"
|
||||
v-model="policyNumber"
|
||||
inputId="policyNumber"
|
||||
validationRules="policy-number-required" />
|
||||
|
|
@ -179,7 +180,7 @@
|
|||
|
||||
<morePolicyQuestions
|
||||
ref="morePolicyQuestions"
|
||||
cmsWidgetName="MorePolicyQuestionsWidget"
|
||||
:cmsWidgetName="morePolicyQuestionsWidgetName"
|
||||
v-model="morePolicyQuestions"
|
||||
groupName="MorePolicyQuestionsQuestion" />
|
||||
|
||||
|
|
@ -215,7 +216,6 @@ 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";
|
||||
|
|
@ -287,15 +287,8 @@ export default {
|
|||
subHeaderSubTextOverride() {
|
||||
return this.clientConfig?.PageInstructionsOverrideWidget?.Text || "";
|
||||
},
|
||||
isUSAA() {
|
||||
return (
|
||||
store.getters.order?.payment?.parentAccountNumber?.toString() ===
|
||||
PARENT_ACCOUNT_NUMBERS.USAA
|
||||
);
|
||||
},
|
||||
policyNumberWidgetName() {
|
||||
console.log("isUSAA", this.isUSAA);
|
||||
return this.isUSAA ? "PolicyNumberUSAAWidget" : "PolicyNumberWidget";
|
||||
policyNumberLabelOverride() {
|
||||
return this.clientConfig?.PolicyNumberLabelOverrideWidget?.Text || "";
|
||||
},
|
||||
policyHelperText() {
|
||||
return this.clientConfig?.PolicyHelperTextOverrideWidget?.Text;
|
||||
|
|
@ -391,6 +384,12 @@ export default {
|
|||
lossLocationQuestionText() {
|
||||
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`
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ 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";
|
||||
|
|
@ -162,14 +161,8 @@ export default {
|
|||
return {};
|
||||
}
|
||||
},
|
||||
isGeico() {
|
||||
return (
|
||||
store.getters.order?.payment?.parentAccountNumber?.toString() ===
|
||||
PARENT_ACCOUNT_NUMBERS.GEICO
|
||||
);
|
||||
},
|
||||
displayDateOfBirth() {
|
||||
return this.parsedClientConfig.displayDateOfBirth && this.isGeico ? true : false;
|
||||
return this.parsedClientConfig.displayDateOfBirth ?? false;
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue