Merge branch 'develop' into feature/digital/SSR-405

This commit is contained in:
Jason Wheeler 2023-04-28 11:00:52 -04:00
commit bb216d1487
15 changed files with 285 additions and 150 deletions

View file

@ -121,7 +121,11 @@ const endpoints = {
IsVinbyAddressPermissible:{ IsVinbyAddressPermissible:{
url:'/vehicle/api/v1/vehicle/is-vin-by-address-permissible', url:'/vehicle/api/v1/vehicle/is-vin-by-address-permissible',
method:'Get' method:'Get'
} },
CoveragePolicyInfo: {
url: '/coverage/api/v1/coverage/get-policy-information',
method: 'POST'
}
}; };
export { endpoints }; export { endpoints };

View file

@ -53,11 +53,18 @@ export default({
}; };
} }
}, },
methods: {
setupHeader(){
const answers = this.getCmsContent(this.cmsWidgetName, "Answers");
if(Array.isArray(answers))
{
this.headerAnswers = answers.filter(x => x.AccountNumber == this.mainStore.issConfig.accountNumber)[0]
this.headerAnswers = !this.headerAnswers ? answers.filter(x => x.AccountNumber === '0')[0] : this.headerAnswers;
}
}
},
mounted() { mounted() {
const answers = this.getCmsContent(this.cmsWidgetName, "Answers"); this.$nextTick(this.setupHeader);
this.headerAnswers = Array.isArray(answers)
? answers.filter(x => x.AccountNumber == this.mainStore.issConfig.accountNumber)[0]
: null;
// Check if alert event is on the bus // Check if alert event is on the bus
const alertEvent = eventBus.readAndPopEventFromBus( const alertEvent = eventBus.readAndPopEventFromBus(
@ -78,11 +85,11 @@ export default({
{ {
document.getElementsByTagName("body")[0].className += " " + clientOverrideClass; document.getElementsByTagName("body")[0].className += " " + clientOverrideClass;
} }
}, },
components: { components: {
menuModal, menuModal,
alert alert
}, },
}) })
</script> </script>

View file

@ -144,6 +144,7 @@
{ {
case "policynumber": case "policynumber":
this.mainStore.order.policy.policyNumber = value; this.mainStore.order.policy.policyNumber = value;
this.mainStore.issConfig.disabledFields.policyNumber = true;
break; break;
case "lossdate": case "lossdate":

View file

@ -6,7 +6,8 @@ import { shallowMount } from '@vue/test-utils';
import { settleAllPromises } from "@/helpers/layout-helper.js"; import { settleAllPromises } from "@/helpers/layout-helper.js";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { getMountOptions } from "@/helpers/unit-test-helper.js";
import { useMainStore } from "@/store";
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
// Mock our module for promises. // Mock our module for promises.
jest.mock("@/helpers/layout-helper.js", () => ({ jest.mock("@/helpers/layout-helper.js", () => ({
@ -65,6 +66,7 @@ describe("navigation", () => {
customerQuestions: { customerQuestions: {
addressQuestions: mockRegistrationAddress, addressQuestions: mockRegistrationAddress,
}, },
isCoverageEnabled:false
}); });
wrapper.vm.navigateForward = jest.fn(); wrapper.vm.navigateForward = jest.fn();
@ -77,6 +79,53 @@ describe("navigation", () => {
}); });
test("if the coverage policy verified navigate forward to policy-vehicle page", async () => {
// Arrange
const mockRegistrationAddress = {
streetAddress: "1234 Main St",
city: "Columbus",
state: "OH",
zipCode: "43215",
};
const { wrapper } = setupMocks();
await wrapper.setData({
firstName: "KK",
lastName:"KK",
customerQuestions: {
addressQuestions: mockRegistrationAddress,
},
isCoverageEnabled : true,
});
const vehiclesFound = [{
vehicles:[
{
vin: "TEST_VIN",
},
{
vin: "TEST_VIN2",
}
]}];
useMainStore().order.policy.policyNumber = "p_0001";
useMainStore().order.policy.dateOfLoss = "2022-01-28";
useMainStore().order.accountNumber = "00000";
// Act
await wrapper.vm.forwardButtonAction();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
undefined,
{},
{},
vehiclesFound
);
});
}); });
function setupMocks() function setupMocks()
@ -97,8 +146,29 @@ function setupMocks()
}) })
); );
const policies = [{
vehicles:[
{
vin: "TEST_VIN",
},
{
vin: "TEST_VIN2",
}
]
},
];
useMainStore().getCoveragePolicyInfo = jest.fn().mockImplementation(() => {
return Promise.resolve({
data: {
policies:policies,
},
})
})
const apiResponses = { const apiResponses = {
policyLookupResponse:{
policies:policies
}
}; };
settleAllPromises.mockImplementation(() => apiResponses); settleAllPromises.mockImplementation(() => apiResponses);

View file

@ -97,17 +97,44 @@ export default {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
forwardButtonAction() async forwardButtonAction()
{ {
this.mainStore.updatePolicyHolderDetails(this.customerQuestions); this.mainStore.updatePolicyHolderDetails(this.customerQuestions);
return this.navigateForward(); //call coverage policy lookup if isCoverageEnabled flag enabled
var vehiclesFound = {};
if(this.isCoverageEnabled){
const policyLookupResponse = this.mainStore.getCoveragePolicyInfo({
accountNumber:this.mainStore.order.accountNumber.toString(),
policyNumber:this.mainStore.order.policy.policyNumber,
dateOfLoss:this.mainStore.order.policy.dateOfLoss});
// Settle promises and get results
const promisePolicyLookupResultMap = [
{
resultKey: "policyLookupResponse",
promise: policyLookupResponse,
}
];
const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap);
vehiclesFound = policyLookupResultMap.policyLookupResponse?.policies;
}
return this.navigateForward(vehiclesFound);
}, },
navigateForward() { navigateForward(vehiclesFound) {
this.$router.navigate( if(vehiclesFound?.length > 0)
this.navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS, this.$router.navigate(
this.$route this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
); this.$route,
{},
{},
vehiclesFound
);
else
this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
this.$route
);
}, },
getPolicyHolderDetailsFromStore() { getPolicyHolderDetailsFromStore() {
return { return {
@ -124,6 +151,11 @@ export default {
} }
}, },
}, },
computed:{
isCoverageEnabled(){
return this.mainStore.issConfig.isCoverageEnabled;
}
},
components: { components: {
siteHeader, siteHeader,
siteSubHeader, siteSubHeader,

View file

@ -9,18 +9,22 @@
</template> </template>
<script> <script>
import buttonQuestion from "@/digital-components/button-question/button-question"; import buttonQuestion from "@/digital-components/button-question/button-question";
export default ({ export default ({
name: "policy-vehicles-question", name: "policy-vehicles-question",
components: { components: {
buttonQuestion, buttonQuestion,
}, },
props:{
vehicles: Array,
},
computed: { computed: {
questionText() { questionText() {
return this.getCmsContent("PolicyVehiclesQuestion", "QuestionText"); return this.getCmsContent("PolicyVehiclesQuestion", "QuestionText");
}, },
answers(){ answers(){
return this.getCmsContent("PolicyVehiclesQuestion", "Answers"); const policyVehiclesAnswerfromCMS = this.getCmsContent("PolicyVehiclesQuestion", "Answers");
const combinedVehicles = [...this.vehicles, ...policyVehiclesAnswerfromCMS];
return combinedVehicles;
}, },
}, },
}) })

View file

@ -9,7 +9,7 @@
<div class="col"> <div class="col">
<div class="select-car-form rounded text-center"> <div class="select-car-form rounded text-center">
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage="true" class="mb-3" /> <vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage="true" class="mb-3" />
<policyVehiclesQuestion class="px-4" cmsWidgetName="PolicyVehiclesQuestion"/> <policyVehiclesQuestion class="px-4" cmsWidgetName="PolicyVehiclesQuestion" :vehicles="VehiclesForQuestions"/>
<siteFooter cmsWidgetName="SiteFooterWidget" ref="siteFooter" :isForwardActionDisabled="!meta.valid" @ForwardClicked="forwardButtonAction" @back-clicked="backButtonAction"/> <siteFooter cmsWidgetName="SiteFooterWidget" ref="siteFooter" :isForwardActionDisabled="!meta.valid" @ForwardClicked="forwardButtonAction" @back-clicked="backButtonAction"/>
</div> </div>
</div> </div>
@ -31,6 +31,9 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import { Form } from "vee-validate"; import { Form } from "vee-validate";
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { issPageValues } from "@/router/router-constants/issPage-values";
import { useMainStore } from '@/store';
export default { export default {
name: "policy-vehicles", name: "policy-vehicles",
mixins: [BaseFormMixin], mixins: [BaseFormMixin],
@ -59,6 +62,29 @@ export default {
}, },
navigateForward() { navigateForward() {
}, },
},
computed:{
VehiclesForQuestions() {
// Map API result data, to address-vehicles data structure
const vehicles = this.VehiclesFromApi?.[0].vehicles;
const mappedData = vehicles.map((v) => {
const maskSymbol = "X";
const vinStart = maskSymbol.repeat(v.vin.length - 6);
const vinEnd = v.vin.substring(v.vin.length - 6);
return {
vin: v.vin,
vehicle: v,
Text: v.vehicleYear + " " + v.vehicleMake + " " + v.vehicleModel,
Name: v.vin,
SubText: "VIN " + vinStart + vinEnd,
};
});
return mappedData;
},
VehiclesFromApi() {
return useMainStore().pageData(issPageValues.POLICY_VEHICLES);
},
}, },
components: { components: {
siteHeader, siteHeader,

View file

@ -28,7 +28,8 @@
buttonTypeString="listCard" buttonTypeString="listCard"
isRequired isRequired
v-model="selectedAppointmentType" v-model="selectedAppointmentType"
validationRules="selection-required"/> validationRules="selection-required"
class="service-location-button-question"/>
<div class="select-car"> <div class="select-car">
<div class="container-fluid pb-2"> <div class="container-fluid pb-2">
<div class="row px-3"> <div class="row px-3">
@ -224,7 +225,6 @@ export default {
.page-container-grouped-styles { .page-container-grouped-styles {
overflow: auto; overflow: auto;
} }
.modal-open { .modal-open {
.page-container-grouped-styles { .page-container-grouped-styles {
overflow: hidden; overflow: hidden;
@ -266,4 +266,9 @@ export default {
padding-left: 0rem !important; padding-left: 0rem !important;
} }
} }
.service-location-button-question {
.question-text {
margin-top: 1.5rem;
}
}
</style> </style>

View file

@ -14,6 +14,7 @@
isRequired isRequired
ref="policyNumber" ref="policyNumber"
disableAutoFill disableAutoFill
:isDisabled="isPolicyHolderEnabled"
validationRules="policy-number-required" /> validationRules="policy-number-required" />
</div> </div>
</div> </div>
@ -107,7 +108,7 @@
v-model="welcomePageModel.damageState" v-model="welcomePageModel.damageState"
ref="state" ref="state"
inputId="8fdf9dc2e13e430eb57529499dceb3eb" inputId="8fdf9dc2e13e430eb57529499dceb3eb"
:options="stateOptions" :options="getStates"
validationRules="loss-state-required" validationRules="loss-state-required"
isRequired isRequired
disableAutoFill disableAutoFill
@ -166,6 +167,7 @@ import { required, regex } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import BaseFormMixin from '@/mixins/base-form-mixin.js'; import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { states } from "@/constants/states"
//define validation rules //define validation rules
defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED)); defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED));
@ -239,7 +241,7 @@ export default {
navigateForward() { navigateForward() {
this.$router.navigate( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE, this.navigationScenarios.CLICKED_FORWARD,
this.$route this.$route
); );
}, },
@ -253,6 +255,7 @@ export default {
isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly, isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly,
phoneNumber : this.mainStore.order.customer.phoneNumber, phoneNumber : this.mainStore.order.customer.phoneNumber,
email : this.mainStore.order.customer.emailAddress, email : this.mainStore.order.customer.emailAddress,
isPolicyNumberDisabled: this.mainStore.order.policy.isPolicyNumberDisabled,
} }
}, },
}, },
@ -278,63 +281,6 @@ export default {
{ {
return this.getCmsContent("GlassOnlyQuestion", "QuestionText"); return this.getCmsContent("GlassOnlyQuestion", "QuestionText");
}, },
stateOptions: {
get: function () {
return {
AL: "Alabama",
AK: "Alaska",
AZ: "Arizona",
AR: "Arkansas",
CA: "California",
CO: "Colorado",
CT: "Connecticut",
DE: "Delaware",
DC: "District Of Columbia",
FL: "Florida",
GA: "Georgia",
HI: "Hawaii",
ID: "Idaho",
IL: "Illinois",
IN: "Indiana",
IA: "Iowa",
KS: "Kansas",
KY: "Kentucky",
LA: "Louisiana",
ME: "Maine",
MD: "Maryland",
MA: "Massachusetts",
MI: "Michigan",
MN: "Minnesota",
MS: "Mississippi",
MO: "Missouri",
MT: "Montana",
NE: "Nebraska",
NV: "Nevada",
NH: "New Hampshire",
NJ: "New Jersey",
NM: "New Mexico",
NY: "New York",
NC: "North Carolina",
ND: "North Dakota",
OH: "Ohio",
OK: "Oklahoma",
OR: "Oregon",
PA: "Pennsylvania",
RI: "Rhode Island",
SC: "South Carolina",
SD: "South Dakota",
TN: "Tennessee",
TX: "Texas",
UT: "Utah",
VT: "Vermont",
VA: "Virginia",
WA: "Washington",
WV: "West Virginia",
WI: "Wisconsin",
WY: "Wyoming",
};
},
},
displayDamageCityQuestion(){ displayDamageCityQuestion(){
return !!this.getCmsContent("DamageCityQuestion","QuestionText"); return !!this.getCmsContent("DamageCityQuestion","QuestionText");
}, },
@ -351,6 +297,13 @@ export default {
else{ else{
return true; return true;
} }
},
getStates() {
return states;
},
isPolicyHolderEnabled()
{
return !!this.mainStore.issConfig.disabledFields.policyNumber;
} }
}, },
components: { components: {

View file

@ -31,6 +31,7 @@ export const issPageValues = {
VIN_LOOKUP: 'vin-lookup', VIN_LOOKUP: 'vin-lookup',
TPA_SUBMIT: 'tpa-submit', TPA_SUBMIT: 'tpa-submit',
BAILOUT_PAGE: 'bailout-page', BAILOUT_PAGE: 'bailout-page',
TPA_SEARCH: 'tpa-search' TPA_SEARCH: 'tpa-search',
POLICY_VEHICLES:'policy-vehicles'
}; };

View file

@ -11,8 +11,10 @@ const navigationScenarios = {
SELECTED_MAKE: "SELECTED_MAKE", SELECTED_MAKE: "SELECTED_MAKE",
SELECTED_MODEL: "SELECTED_MODEL", SELECTED_MODEL: "SELECTED_MODEL",
SELECTED_STYLE: "SELECTED_STYLE", SELECTED_STYLE: "SELECTED_STYLE",
CLICKED_FORWARD_WELCOME_PAGE: "CLICKED_FORWARD_WELCOME_PAGE",
CLICKED_FORWARD_POLICY_HOLDER_DETAILS: "CLICKED_FORWARD_POLICY_HOLDER_DETAILS", //Policy Holder Details
CLICKED_FORWARD_POLICY_UNVERIFIED: "CLICKED_FORWARD_POLICY_UNVERIFIED",
CLICKED_FORWARD_POLICY_VERIFIED: "CLICKED_FORWARD_POLICY_VERIFIED",
// Vehicle Damage // Vehicle Damage
CLICKED_FORWARD_WITH_REPAIR: 'CLICKED_FORWARD_WITH_REPAIR', CLICKED_FORWARD_WITH_REPAIR: 'CLICKED_FORWARD_WITH_REPAIR',

View file

@ -375,7 +375,7 @@ const routingTable = function(store) {
destinationIssPageValue: issPageValues.WELCOME_PAGE destinationIssPageValue: issPageValues.WELCOME_PAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE, scenario: navigationScenarios.CLICKED_FORWARD,
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
} }
] ]
@ -388,8 +388,12 @@ const routingTable = function(store) {
destinationIssPageValue: issPageValues.WELCOME_PAGE destinationIssPageValue: issPageValues.WELCOME_PAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS, scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
destinationIssPageValue: issPageValues.VEHICLE_YEAR destinationIssPageValue: issPageValues.VEHICLE_YEAR
},
{
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
destinationIssPageValue: issPageValues.POLICY_VEHICLES
} }
] ]
}, },

View file

@ -15,7 +15,7 @@ describe("Router", () => {
it("Should push next view when navigating locally", () => { it("Should push next view when navigating locally", () => {
let scenario = navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE; let scenario = navigationScenarios.CLICKED_FORWARD;
let currentRoute = { query: { issPage: issPageValues.WELCOME_PAGE }}; let currentRoute = { query: { issPage: issPageValues.WELCOME_PAGE }};
router.push = jest.fn(); router.push = jest.fn();

View file

@ -47,7 +47,7 @@ const getDefaultState = () => {
damageCause: null, damageCause: null,
damageState: null, damageState: null,
damageCity: null, damageCity: null,
isDamageGlassOnly: null isDamageGlassOnly: null,
}, },
customer: { customer: {
address: { address: {
@ -104,7 +104,10 @@ const getDefaultState = () => {
isAuthenticated: false, // Indicates if user is authenticated or not. isAuthenticated: false, // Indicates if user is authenticated or not.
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client. enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
returnURL: null, returnURL: null,
returnURL2: null returnURL2: null,
disabledFields: {
policyNumber: null
}
} }
}; };
}; };
@ -320,6 +323,26 @@ export const useMainStore = defineStore({
}; };
} }
}, },
getCoveragePolicyInfo({accountNumber,policyNumber,dateOfLoss}){
try{
const response = globalMethods.callHttpClient({
method:endpoints.CoveragePolicyInfo.method,
endpoint:endpoints.CoveragePolicyInfo.url,
payload: {
accountNumber: accountNumber,
policyNumber: policyNumber,
dateOfLoss: dateOfLoss
}
});
return response;
} catch (responseError) {
return {
error: {
status: responseError.status
}
};
}
},
async lookupVinByPlate(licensePlate, licenseState) { async lookupVinByPlate(licensePlate, licenseState) {
try { try {
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
@ -717,6 +740,7 @@ export const useMainStore = defineStore({
this.issConfig.enableTPAFlow = false; this.issConfig.enableTPAFlow = false;
this.issConfig.returnURL = null; this.issConfig.returnURL = null;
this.issConfig.returnURL2 = null; this.issConfig.returnURL2 = null;
this.issConfig.disabledFields.policyNumber = null;
}, },
updateVehicleYear(year) { updateVehicleYear(year) {

View file

@ -158,65 +158,67 @@ export default {
} }
} }
.col, .windshield-chip-count-question {
.list-group { .col,
border-radius: 0; .list-group {
border-radius: 0;
&:first-of-type { &:first-of-type {
.list-button-horizontal { .list-button-horizontal {
border-bottom-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem;
border-top-left-radius: 0.5rem; border-top-left-radius: 0.5rem;
.list-button-horizontal-content { .list-button-horizontal-content {
border-bottom-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem;
border-top-left-radius: 0.5rem; border-top-left-radius: 0.5rem;
} }
} }
} }
&:last-of-type { &:last-of-type {
.list-button-horizontal { .list-button-horizontal {
border-bottom-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem;
border-top-right-radius: 0.5rem; border-top-right-radius: 0.5rem;
.list-button-horizontal-content { .list-button-horizontal-content {
border-bottom-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem;
border-top-right-radius: 0.5rem; border-top-right-radius: 0.5rem;
} }
} }
} }
//Cash/insurance styling //Cash/insurance styling
&:first-of-type { &:first-of-type {
.list-button-horizontal.strong { .list-button-horizontal.strong {
input[type="radio"] { input[type="radio"] {
&:checked + .list-button-horizontal-content { &:checked + .list-button-horizontal-content {
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
&:checked:focus + .list-button-horizontal-content { &:checked:focus + .list-button-horizontal-content {
border-bottom-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem;
border-top-right-radius: 0.5rem; border-top-right-radius: 0.5rem;
} }
} }
} }
} }
&:last-of-type { &:last-of-type {
.list-button-horizontal.strong { .list-button-horizontal.strong {
input[type="radio"] { input[type="radio"] {
&:checked + .list-button-horizontal-content { &:checked + .list-button-horizontal-content {
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
} }
&:checked:focus + .list-button-horizontal-content { &:checked:focus + .list-button-horizontal-content {
border-bottom-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem;
border-top-left-radius: 0.5rem; border-top-left-radius: 0.5rem;
} }
} }
} }
} }
}
} }
</style> </style>