From 9b470eb959231c26f97ce697a00d436d1d5b23f4 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Wed, 18 Jan 2023 07:36:19 -0500 Subject: [PATCH 1/8] commit --- src/layouts/welcome-page/welcome-page.vue | 26 +++++++++++++++-------- src/store/index.js | 23 +++++++++++++++++++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 23c6f278..b7aa2401 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -145,6 +145,7 @@ import { required, regex } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import BaseFormMixin from '@/mixins/base-form-mixin.js'; + import { useMainStore } from '@/store'; //define validation rules defineRule("loss-date-required", required(errorMessages.LOSS_DATE_REQUIRED)); @@ -177,7 +178,6 @@ data() { return { policyNumber: "", - policyZipCode: "", dateOfLoss: "", damageCause: "", damageState: "", @@ -187,6 +187,10 @@ email: "" }; }, + setup() { + const mainStore = useMainStore(); + return { mainStore }; + }, async beforeRouteEnter(to, from, next) { // Call APIs @@ -210,6 +214,18 @@ methods: { async forwardButtonAction() { + const welcomePageModel = JSON.stringify({ + PolicyNumber: this.policyNumber, + DateOfLoss: this.dateOfLoss, + DamageCause: this.damageCause, + DamageState: this.damageState, + DamageCity: this.damageCity, + IsDamageGlassOnly: this.isDamageGlassOnly, + PhoneNumber: this.phoneNumber, + Email: this.email + }); + + this.mainStore.updatePolicyData(welcomePageModel); return this.navigateForward(); }, @@ -299,14 +315,6 @@ }; }, }, - welcomePageModel: { - get: function () { - return this.modelValue; - }, - set: function (newValue) { - this.$emit("update:modelValue", newValue); - }, - }, }, components: { siteHeader, diff --git a/src/store/index.js b/src/store/index.js index bbb214e8..5e6856f2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -41,6 +41,16 @@ const getDefaultState = () => { moldingQuestionAnswers: null, capabilityQuestionAnswers: null, }, + policy:{ + policyNumber: null, + dateOfLoss: null, + damageCause: null, + damageState: null, + damageCity: null, + isDamageGlassOnly: null, + phoneNumber: null, + email: null, + }, serviceLocation: { address: null, city: null, @@ -541,7 +551,18 @@ export const useMainStore = defineStore({ updatePageData(pageData) { this.applicationUser.pageData[pageData.page] = pageData.data; }, - + updatePolicyData(welcomePageModel) + { + const welcomePageData = JSON.parse(welcomePageModel); + this.order.policy.policyNumber = welcomePageData.PolicyNumber; + this.order.policy.dateOfLoss = welcomePageData.DateOfLoss; + this.order.policy.damageCause = welcomePageData.DamageCause; + this.order.policy.damageState = welcomePageData.DamageState; + this.order.policy.damageCity = welcomePageData.DamageCity; + this.order.policy.isDamageGlassOnly = welcomePageData.IsDamageGlassOnly; + this.order.policy.phoneNumber = welcomePageData.PhoneNumber; + this.order.policy.email = welcomePageData.Email; + }, savePartQuestionAnswers(partQuestionAnswersArray) { // if part question answers have changed, reset subsequent question answers const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue( From 8e0ec66203f2c37e44e7f1caf8a6eaa900dd8009 Mon Sep 17 00:00:00 2001 From: Johan Gunawan Date: Wed, 18 Jan 2023 15:36:46 -0500 Subject: [PATCH 2/8] SSR-189 --- .../vin-location-information.spec.js | 58 +++ .../vehicle-not-found-alert.vue | 1 + .../vehicle-not-matched-alert.vue | 1 + .../vin-lookup-alerts.spec.js | 57 +++ src/layouts/vin-lookup/vin-lookup.spec.js | 453 ++++++++++++++++++ src/layouts/vin-lookup/vin-lookup.vue | 127 +++-- src/router/router-constants/routing-table.js | 26 +- src/router/router-params.js | 6 +- src/store/index.js | 10 + 9 files changed, 706 insertions(+), 33 deletions(-) create mode 100644 src/layouts/vin-lookup/vin-location-information/vin-location-information.spec.js create mode 100644 src/layouts/vin-lookup/vin-lookup-alerts/vin-lookup-alerts.spec.js create mode 100644 src/layouts/vin-lookup/vin-lookup.spec.js diff --git a/src/layouts/vin-lookup/vin-location-information/vin-location-information.spec.js b/src/layouts/vin-lookup/vin-location-information/vin-location-information.spec.js new file mode 100644 index 00000000..b6a5ed5d --- /dev/null +++ b/src/layouts/vin-lookup/vin-location-information/vin-location-information.spec.js @@ -0,0 +1,58 @@ +/* eslint-env jest */ +import { render } from '@testing-library/vue'; +import userEvent from '@testing-library/user-event'; +import '@testing-library/jest-dom'; +import VinLocationInformationComponent from './vin-location-information.vue'; + +const mockText = Object.freeze({ + HEADER: 'Mock Header', + BODY: 'Mock Body', +}); + +const mountOptions = { + global: { + mixins: [ + { + methods: { + getCmsContent: jest.fn((cmsWidgetName, fieldName) => { + if (cmsWidgetName === 'WhereCanIFindMyVINToggle') { + if (fieldName === 'HeaderText') { + return mockText.HEADER; + } + + if (fieldName === 'BodyText') { + return mockText.BODY; + } + } + + return ''; + }), + }, + }, + ], + }, +}; + +describe('vin-location-information.vue', () => { + test('VIN Location Detail is NOT displayed on the screen as a default.', () => { + const { container } = render(VinLocationInformationComponent, mountOptions); + + const vinLocationDetailSection = container.querySelector('#vin-location-detail-wrapper'); + + expect(vinLocationDetailSection).not.toBeVisible(); + }); + + test('Toggling VIN Location Detail', async () => { + const user = userEvent.setup(); + const { container, getByText } = render(VinLocationInformationComponent, mountOptions); + const toggleLink = getByText(mockText.HEADER); + + await user.click(toggleLink); + let vinLocationDetailSection = container.querySelector('#vin-location-detail-wrapper'); + expect(vinLocationDetailSection).toBeVisible(); + + await user.click(toggleLink); + vinLocationDetailSection = container.querySelector('#vin-location-detail-wrapper'); + expect(vinLocationDetailSection).not.toBeVisible(); + }); +}); diff --git a/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert.vue b/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert.vue index dba53894..d6a27140 100644 --- a/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert.vue +++ b/src/layouts/vin-lookup/vin-lookup-alerts/vehicle-not-found-alert/vehicle-not-found-alert.vue @@ -3,6 +3,7 @@ alertClass="alert-danger" cmsWidgetName="AlertVinNotFoundWidget" id="vehicle-not-found-alert" + aria-label="vehicle-not-found-alert" /> diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index eafc217b..273fccb4 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -100,7 +100,31 @@ const routingTable = function(store) { { scenario: navigationScenarios.CLICKED_BACK, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, - }, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, + destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, + destinationIssPageValue: issPageValues.PART_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, + destinationIssPageValue: issPageValues.VEHICLE_PARTS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, + destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, + destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, + destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, + }, ], }, { diff --git a/src/router/router-params.js b/src/router/router-params.js index a8ee17b9..ee03d859 100644 --- a/src/router/router-params.js +++ b/src/router/router-params.js @@ -1,5 +1,5 @@ -const routerParams = { - DISPLAY_VEHICLE_CHANGE_ALERT: "displayVehicleChangeAlert", -}; +const routerParams = Object.freeze({ + DISPLAY_VEHICLE_CHANGE_ALERT: "displayVehicleChangeAlert", +}); export { routerParams }; \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index 95d626f7..f9ce744e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -389,6 +389,16 @@ export const useMainStore = defineStore({ }); }, + lookupVehicleByVin(vin) { + return globalMethods.callHttpClient({ + method: endpoints.LookupVehicleByVin.method, + endpoint: endpoints.LookupVehicleByVin.url, + payload: { + vin, + }, + }); + }, + setVehicle() { return globalMethods .callHttpClient({ From d8a51533c49d5c2d8a4387ad5ec48cd251d2ee4e Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Wed, 18 Jan 2023 16:47:12 -0500 Subject: [PATCH 3/8] Removed references to serviceZip and servicability checks. These will be done earlier in the flow. --- .../address-lookup/address-lookup.spec.js | 239 +----------------- src/layouts/address-lookup/address-lookup.vue | 126 +-------- 2 files changed, 10 insertions(+), 355 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.spec.js b/src/layouts/address-lookup/address-lookup.spec.js index ebc75059..ae7658c5 100644 --- a/src/layouts/address-lookup/address-lookup.spec.js +++ b/src/layouts/address-lookup/address-lookup.spec.js @@ -7,7 +7,6 @@ import { shallowMount } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { useMainStore } from "@/store"; import { navigationScenarios } from "@/router/router-constants/navigation-scenarios"; -import e from "express"; jest.mock("@/helpers/damage-helper", () => ({ isGlassAvailableForCarId: jest.fn().mockImplementation(() => true), @@ -21,48 +20,6 @@ jest.mock("@/helpers/layout-helper.js", () => ({ describe("address-lookup.vue", () => { describe("page level alerts", () => { - test("if the address is not serviceable display the Non-Serviceable Zip Alert", async () => { - // Arrange - const mockRegistrationAddress = { - streetAddress: "1234 Main St", - city: "Columbus", - state: "OH", - zipCode: "43215", - }; - - const { wrapper } = setupMocks({ - isZipValid: true, - isZipServiceable: false, - vinVehicles: [ - { - vin: "TEST_VIN", - vehicle: { - carId: "C0000", - }, - }, - { - vin: "TEST_VIN", - vehicle: { - carId: "C0000", - }, - }, - ], - }); - - await wrapper.setData({ - customerQuestions: { - addressQuestions: mockRegistrationAddress, - }, - - }); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(wrapper.findComponent({ ref: "alertNonServiceableZip" }).isVisible()).toBe(true); - }); - test("if the address matches a different vehicle display the Matched Different VehicleAlert", async () => { // Arrange const mockRegistrationAddress = { @@ -73,7 +30,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, vinVehicles: [ { vehicle: { @@ -110,7 +66,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, isStatePermissible: false, lookupVinbyAddressResponse: { isStatePermissible: false, @@ -158,7 +113,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, lookupVinbyAddressResponse: { isStatePermissible: true, vinVehicles: [], // Return no vehicles @@ -188,7 +142,6 @@ describe("address-lookup.vue", () => { test("if the back button is clicked, navigate back", async () => { // Arrange const { wrapper } = setupMocks({ - isZipServiceable: true, }); // Act @@ -198,7 +151,7 @@ describe("address-lookup.vue", () => { expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); }); - test("if the car entered matches one of the vehicles found and the zip is serviceable, navigate forward", async () => { + test("if the car entered matches one of the vehicles found navigate forward", async () => { // Arrange const mockRegistrationAddress = { streetAddress: "1234 Main St", @@ -208,7 +161,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, vinVehicles: [ { vehicle: { @@ -244,7 +196,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, isStatePermissible: true, vinVehicles: [ { @@ -299,52 +250,7 @@ describe("address-lookup.vue", () => { carsFound ); }); - - test("if the car entered matches one of the vehicles found but the zip is NOT serviceable, do not navigate forward", async () => { - // Arrange - const mockRegistrationAddress = { - streetAddress: "1234 Main St", - city: "Columbus", - state: "OH", - zipCode: "43215", - }; - - const { wrapper } = setupMocks({ - isZipServiceable: false, - isStatePermissible: true, - vinVehicles: [ - { - vin: "TEST_VIN", - vehicle: { - carId: "CARID", - }, - }, - { - vin: "TEST_VIN2", - vehicle: { - carId: "CARID2", - }, - }, - ], - }); - - useMainStore().order.vehicle.carId = "CARID"; - - await wrapper.setData({ - customerQuestions: { - addressQuestions: mockRegistrationAddress, - }, - }); - - wrapper.vm.navigateForward = jest.fn(); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(wrapper.vm.navigateForward).toHaveBeenCalledTimes(0); - }); - + test("if a different vehicle is found than the one entered and the selected glass is not available for that vehicle, navigate back to vehicle-damage page", async () => { // Arrange const mockRegistrationAddress = { @@ -355,7 +261,6 @@ describe("address-lookup.vue", () => { }; const { wrapper } = setupMocks({ - isZipServiceable: true, isStatePermissible: true, }); @@ -450,135 +355,9 @@ describe("address-lookup.vue", () => { }); }); - - describe("registration and service zips", () => { - describe("if registration zip is serviceable", () => { - test("if registration address is provided => update service address on successful continue", async () => { - // Arrange - const mockRegistrationAddress = { - streetAddress: "1234 Main St", - city: "Columbus", - state: "OH", - zipCode: "43215", - }; - - const { wrapper } = setupMocks({ - isZipServiceable: true, - isStatePermissible: true, - vinVehicles: [ - { - vin: "TEST_VIN", - vehicle: { - carId: "CARID", - }, - }, - ], - route: { query: "address-lookup" }, - }); - - useMainStore().order.vehicle.carId = "CARID"; - useMainStore().saveRegistrationAddressLookup = jest.fn(); - - await wrapper.setData({ - customerQuestions: { - addressQuestions: mockRegistrationAddress, - }, - }); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(useMainStore().saveRegistrationAddressLookup).toHaveBeenCalled(); - expect(useMainStore().validateZip).toHaveBeenCalledWith({ zip: "43215" }); - }); - }); - - describe("if registration zip is not serviceable", () => { - test("if registration address is provided and user clicks continue => show non-serviceable zip alert", async () => { - // Arrange - const mockRegistrationAddress = { - streetAddress: "1234 Main St", - city: "Columbus", - state: "OH", - zipCode: "43215", - }; - - const { wrapper } = setupMocks({ - isZipValid: true, - isZipServiceable: false, - vinVehicles: [ - { - vin: "TEST_VIN", - vehicle: { - carId: "C0000", - }, - }, - ], - }); - - useMainStore().order.vehicle.carId = "C0000"; - - await wrapper.setData({ - customerQuestions: { - addressQuestions: mockRegistrationAddress, - }, - }); - - expect(wrapper.findComponent({ ref: "alertNonServiceableZip" }).exists()).toBe( - false - ); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(wrapper.vm.displayNonServiceableZipAlert).toBe(true); - expect(wrapper.findComponent({ ref: "alertNonServiceableZip" }).exists()).toBe( - true - ); - expect(wrapper.findComponent({ ref: "alertNonServiceableZip" }).isVisible()).toBe( - true - ); - }); - - test("if registration address, service zip are provided, and user clicks continue => don't update service address", async () => { - // Arrange - const mockRegistrationAddress = { - streetAddress: "1234 Main St", - city: "Columbus", - state: "OH", - zipCode: "43215", - }; - - const { wrapper } = setupMocks({ - isZipServiceable: false, - }); - - useMainStore().order.vehicle.carId = "CARID"; - - await wrapper.setData({ - customerQuestions: { - addressQuestions: mockRegistrationAddress, - }, - }); - - useMainStore().saveRegistrationAddressLookup = jest.fn(); - - // Act - await wrapper.vm.forwardButtonAction(); - - // Assert - expect(useMainStore().saveRegistrationAddressLookup).not.toHaveBeenCalled(); - }); - }); - }); - }); function setupMocks({ - isZipValid = true, - isZipServiceable = true, lookupVinbyAddressResponse, partsOrQuestions = [], isStatePermissible = true, @@ -587,16 +366,6 @@ function setupMocks({ route = null, }) { - - useMainStore().validateZip = jest.fn().mockImplementation(() => { - return Promise.resolve({ - data: { - isValid: isZipValid, - isServiceable: isZipServiceable, - }, - }) - }); - useMainStore().lookupVinByAddress = jest.fn().mockImplementation(() => { return Promise.resolve({ data: lookupVinbyAddressResponse @@ -652,10 +421,6 @@ function setupMocks({ ); const apiResponses = { - serviceZipValidationResponse: { - isValid: isZipValid, - isServiceable: isZipServiceable, - }, vinLookupResponse: { isStatePermissible: isStatePermissible, vinVehicles: vinVehicles, diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index b88c10c6..77ee771a 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -28,21 +28,6 @@ :manualCopy="AlertMatchedDifferentVehicleBody" alertClass="alert-warning" v-bind:isDismissible="false" /> - - - -
-
-
- -
-
-
-
+ + 1) { + // If multiple cars were found and one and only one of them matches the carId entered, save the vehicle info - // so we can go to the Heritage Funnel directly const matchingCars = carsFound.filter( (vin) => vin.vehicle.carId === this.mainStore.order.vehicle.carId ); @@ -273,52 +218,26 @@ export default { return this.$refs.siteFooter.removeLoader(); } - // If the either the registration zip code or service zip code are not serviceable - this.isZipServiceable = resultMap.serviceZipValidationResponse.isServiceable; - if (!this.isZipServiceable) { - this.displayNonServiceableZipAlert = true; - this.$refs.siteFooter.disableForwardButton(); - this.showServiceZipField = true; - return this.$refs.siteFooter.removeLoader(); - } - - // If the registration zip code is serviceable and nothing was entered for the service zip code - // then set the service zip code to the registration zip code - if (!this.serviceZipCode) { - this.serviceZipCode = this.customerQuestions.addressQuestions.zipCode; - } - // Save vehicle, customer, service and registration information await useMainStore().saveRegistrationAddressLookup( { isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, vehicleInfo: Object.keys(vehicleInfoToCommit).length === 0 - ? this.mainStore.order.vehicle + ? useMainStore().order.vehicle : vehicleInfoToCommit, registrationInfo: { firstName: this.customerQuestions.firstName, lastName: this.customerQuestions.lastName, address: this.customerQuestions.addressQuestions.streetAddress, city: this.customerQuestions.addressQuestions.city, - state: resultMap.serviceZipValidationResponse.state, + state: this.customerQuestions.addressQuestions.state, zipCode: this.customerQuestions.addressQuestions.zipCode, }, }, false ); - await useMainStore().saveServiceLocation( - { - address: this.customerQuestions.addressQuestions.streetAddress, - city: this.customerQuestions.addressQuestions.city, - zipCode: this.serviceZipCode, - state: resultMap.serviceZipValidationResponse.state, - zipCodeCtu: resultMap.serviceZipValidationResponse.zipCodeCtu, - }, - false - ); - return await this.navigateForward(carsFound); }, async navigateForward(carsFound) { @@ -353,7 +272,6 @@ export default { }, resetWarningsAndErrors() { this.displayVinNotFoundAlert = false; - this.displayNonServiceableZipAlert = false; this.displayMatchedDifferentVehicleAlert = false; this.displayVinLookupByHomeAddressNotAllowedAlert = false; this.$refs.siteFooter.enableForwardAction(); @@ -364,19 +282,6 @@ export default { this.loadDefaultsFromStore(); }, computed: { - AlertNonServiceableZipHeader() { - const zipCode = this.serviceZipCode - ? this.serviceZipCode - : this.customerQuestions.addressQuestions.zipCode; - const text = this.getCmsContent( - "AlertNonServiceableZipWidget", - "HeadlineText" - ).replaceAll("{custom:serviceZip}", zipCode); - return text; - }, - AlertNonServiceableZipBody() { - return this.getCmsContent("AlertNonServiceableZipWidget", "BodyText"); - }, AlertMatchedDifferentVehicleHeader() { return this.getCmsContent( "AlertMatchedDifferentVehicleWidget", @@ -400,25 +305,10 @@ export default { this.$refs.siteFooter.updateButtonText( this.getCmsContent("siteFooterWidget", "ForwardButtonText") ); - this.showServiceZipField = false; this.resetWarningsAndErrors(); }, deep: true, - }, - serviceZipCode: { - handler(newValue) { - // If they modify the service zip code, then hide the error message. - this.resetWarningsAndErrors(); - }, - }, - showServiceZipField: { - handler(newValue) { - // If the Service Zip Code field is ever hidden, clear out it's value - if (!newValue) { - this.serviceZipCode = null; - } - }, - }, + } }, components: { siteHeader, From d47b81b52ab455d31900ffd575a7ac8ad5a48b15 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Thu, 19 Jan 2023 07:48:45 -0500 Subject: [PATCH 4/8] commit --- src/layouts/welcome-page/welcome-page.vue | 31 ++++++++--------------- src/store/index.js | 19 +++++++------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index b7aa2401..741c5371 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -9,7 +9,7 @@ { moldingQuestionAnswers: null, capabilityQuestionAnswers: null, }, - policy:{ + policy: { policyNumber: null, dateOfLoss: null, damageCause: null, @@ -647,15 +647,14 @@ export const useMainStore = defineStore({ }, updatePolicyData(welcomePageModel) { - const welcomePageData = JSON.parse(welcomePageModel); - this.order.policy.policyNumber = welcomePageData.PolicyNumber; - this.order.policy.dateOfLoss = welcomePageData.DateOfLoss; - this.order.policy.damageCause = welcomePageData.DamageCause; - this.order.policy.damageState = welcomePageData.DamageState; - this.order.policy.damageCity = welcomePageData.DamageCity; - this.order.policy.isDamageGlassOnly = welcomePageData.IsDamageGlassOnly; - this.order.policy.phoneNumber = welcomePageData.PhoneNumber; - this.order.policy.email = welcomePageData.Email; + this.order.policy.policyNumber = welcomePageModel?.policyNumber; + this.order.policy.dateOfLoss = welcomePageModel?.dateOfLoss; + this.order.policy.damageCause = welcomePageModel?.damageCause; + this.order.policy.damageState = welcomePageModel?.damageState; + this.order.policy.damageCity = welcomePageModel?.damageCity; + this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly; + this.order.policy.phoneNumber = welcomePageModel?.phoneNumber; + this.order.policy.email = welcomePageModel?.email; }, savePartQuestionAnswers(partQuestionAnswersArray) { // if part question answers have changed, reset subsequent question answers From f142f129f55f19f6018e8a54ef3d8ebfcb6cf965 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Thu, 19 Jan 2023 09:22:22 -0500 Subject: [PATCH 5/8] commit --- src/layouts/welcome-page/welcome-page.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 741c5371..d2c3ac8d 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -230,16 +230,16 @@ computed:{ DamageCauseOptions() { const damageCauseAnswers = this.getCmsContent("DamageCauseQuestion", "Answers"); - const answerArray = []; + const damageCauseAnswersObj ={}; if(damageCauseAnswers) { for (let answer of Object.values(damageCauseAnswers)) { if (answer?.Name) { - answerArray.push(answer.Name); + damageCauseAnswersObj[answer.Name] = answer.Name; } } } - return answerArray; + return damageCauseAnswersObj; }, DamageGlassOnlyOptions() { From 4ef0a833113c01edfec4cd3a01dc1047c2f7160d Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Thu, 19 Jan 2023 10:20:05 -0500 Subject: [PATCH 6/8] changes to load data back to page from store up on return --- src/layouts/welcome-page/welcome-page.vue | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index d2c3ac8d..77b42f16 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -177,16 +177,7 @@ mixins: [BaseFormMixin], data() { return { - welcomePageModel: { - policyNumber: "", - dateOfLoss: "", - damageCause: "", - damageState: "", - damageCity: "", - isDamageGlassOnly: "", - phoneNumber: "", - email: "" - }, + welcomePageModel: this.getWelcomePageModelFromStore() }; }, setup() { @@ -226,6 +217,18 @@ this.$route ); }, + getWelcomePageModelFromStore() { + return { + policyNumber : this.mainStore.order.policy.policyNumber, + dateOfLoss : this.mainStore.order.policy.dateOfLoss, + damageCause : this.mainStore.order.policy.damageCause, + damageState : this.mainStore.order.policy.damageState, + damageCity : this.mainStore.order.policy.damageCity, + isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly, + phoneNumber : this.mainStore.order.policy.phoneNumber, + email : this.mainStore.order.policy.email, + } + }, }, computed:{ DamageCauseOptions() { From 006135f844943783998d9d07852054d1f7bbe938 Mon Sep 17 00:00:00 2001 From: Kulbhushan Kaushik Date: Thu, 19 Jan 2023 10:22:53 -0500 Subject: [PATCH 7/8] commit --- src/layouts/welcome-page/welcome-page.vue | 4 ++-- src/store/index.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 77b42f16..57c3d583 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -225,8 +225,8 @@ damageState : this.mainStore.order.policy.damageState, damageCity : this.mainStore.order.policy.damageCity, isDamageGlassOnly : this.mainStore.order.policy.isDamageGlassOnly, - phoneNumber : this.mainStore.order.policy.phoneNumber, - email : this.mainStore.order.policy.email, + phoneNumber : this.mainStore.order.customer.phoneNumber, + email : this.mainStore.order.customer.emailAddress, } }, }, diff --git a/src/store/index.js b/src/store/index.js index e228bee1..641adeb8 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -48,8 +48,6 @@ const getDefaultState = () => { damageState: null, damageCity: null, isDamageGlassOnly: null, - phoneNumber: null, - email: null, }, customer: { address: { @@ -61,6 +59,7 @@ const getDefaultState = () => { firstName: null, lastName: null, emailAddress: null, + phoneNumber: null, }, serviceLocation: { address: null, @@ -663,8 +662,8 @@ export const useMainStore = defineStore({ this.order.policy.damageState = welcomePageModel?.damageState; this.order.policy.damageCity = welcomePageModel?.damageCity; this.order.policy.isDamageGlassOnly = welcomePageModel?.isDamageGlassOnly; - this.order.policy.phoneNumber = welcomePageModel?.phoneNumber; - this.order.policy.email = welcomePageModel?.email; + this.order.customer.phoneNumber = welcomePageModel?.phoneNumber; + this.order.customer.emailAddress = welcomePageModel?.email; }, savePartQuestionAnswers(partQuestionAnswersArray) { // if part question answers have changed, reset subsequent question answers From 2bba9ac1f448ddb417249aae6f2dca8dde3ff86f Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Thu, 19 Jan 2023 11:23:37 -0500 Subject: [PATCH 8/8] Migrated address-questions to common-components --- .../address-questions/address-questions.spec.js | 3 +-- .../address-questions/address-questions.vue | 0 src/layouts/address-lookup/address-lookup.vue | 4 +--- .../address-lookup/customer-questions/customer-questions.vue | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) rename src/{layouts/address-lookup/customer-questions => common-components}/address-questions/address-questions.spec.js (99%) rename src/{layouts/address-lookup/customer-questions => common-components}/address-questions/address-questions.vue (100%) diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js b/src/common-components/address-questions/address-questions.spec.js similarity index 99% rename from src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js rename to src/common-components/address-questions/address-questions.spec.js index 48a637aa..b72b4ef4 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js +++ b/src/common-components/address-questions/address-questions.spec.js @@ -1,6 +1,5 @@ // Components -import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions"; -import alert from "@/ux-components/alert/alert"; +import addressQuestions from "@/common-components/address-questions/address-questions"; // Supporting Files import { mount, shallowMount } from "@vue/test-utils"; diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/common-components/address-questions/address-questions.vue similarity index 100% rename from src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue rename to src/common-components/address-questions/address-questions.vue diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 77ee771a..fc692200 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -61,9 +61,7 @@ import customerQuestions from "@/layouts/address-lookup/customer-questions/custo import alert from "@/ux-components/alert/alert"; import textboxQuestion from "@/common-components/textbox-question/textbox-question"; -import { Form, defineRule } from "vee-validate"; -import { required, regex } from "@/helpers/validation-rules"; -import { errorMessages } from "@/constants/error-messages"; +import { Form } from "vee-validate"; // Supporting files import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; diff --git a/src/layouts/address-lookup/customer-questions/customer-questions.vue b/src/layouts/address-lookup/customer-questions/customer-questions.vue index 683cbf94..57aeff5b 100644 --- a/src/layouts/address-lookup/customer-questions/customer-questions.vue +++ b/src/layouts/address-lookup/customer-questions/customer-questions.vue @@ -25,7 +25,7 @@