From 99f6ef3a4e958c03029d0b4a36a773429a0baa7c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 10:40:45 -0400 Subject: [PATCH] WIP --- .../service-location-helper.js | 14 -------------- .../mobile-location-modal-questions.vue | 16 +++++++++++++--- .../service-location/service-location.vue | 17 +++++++++-------- .../service-zip-modal-question.vue | 16 ++++++++++++++++ src/store/index.js | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 0622aead1..ed05de924 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -39,17 +39,3 @@ export async function getPricedMobileFeePart( return Promise.resolve(pricingResults[0]); } -export async function resetMobileFeePart(serviceZipCode) { - const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; - const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 1; - - getPricedMobileFeePart( - serviceZipCode, - serviceType, - parentAccountNumber, - billToAccountNumber - ).then((pricedMobileFeePart) => { - this.mobileFeePart = pricedMobileFeePart; - }); -} diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 3a40ef9db..deb23e8e4 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -56,9 +56,11 @@ import modal from "@/digital-components/modal/modal"; import alert from "@/ux-components/alert/alert"; import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions"; import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question"; +import store from "@/store"; // Helpers import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "mobile-location-modal-questions", @@ -165,9 +167,6 @@ export default { resetModalButtonStyle() { this.$refs[this.modalName].resetButtonStyle(); }, - onAddressUpdated(updatedServiceZipCodeInfo) { - this.resetComponent(updatedServiceZipCodeInfo); - }, async setMobileLocation() { // Validate the Zip Code const zipCodeData = await this.getZipCodeData( @@ -178,6 +177,17 @@ export default { this.displayInvalidZipAlert = true; this.resetModalButtonStyle(); } else { + + // retrieve mobile fee part + const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = store.getters.payment.parentAccountNumber; + const billToAccountNumber = 1; + + const mobileFeePart = await getPricedMobileFeePart(this.internalModel.addressQuestions.zipCode, serviceType, parentAccountNumber, billToAccountNumber); + + // emit it to parent + this.$emit("set-mobile-fee-part", mobileFeePart); + // Update the page level model this.$emit("update:modelValue", this.internalModel); this.closeModal(); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 3872ab68a..0242d7210 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -7,11 +7,14 @@ @@ -37,10 +40,7 @@ import { Form } from "vee-validate"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; -import { - getPricedMobileFeePart, - resetMobileFeePart, -} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; import store from "@/store"; export default { @@ -104,7 +104,7 @@ export default { }, set: function (newValue) { if (newValue.zipCode !== this.zipCode) { - this.resetMobileLocation(newValue); + this.resetMobileLocation(); } this.state = newValue.state; @@ -160,14 +160,15 @@ export default { getServiceZipCodeFromStore() { return store.getters.order.serviceLocation.zipCode; }, - resetMobileLocation(updatedServiceZipCodeInfo) { + setMobileFeePart(mobileFeePart) { + this.mobileFeePart = mobileFeePart; + }, + resetMobileLocation() { this.streetAddress = ""; this.apartmentNumberOrBusinessName = ""; this.city = ""; this.isVehicleProtected = null; - - this.resetMobileFeePart(updatedServiceZipCodeInfo.zipCode); }, backButtonAction() { this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index 4f4c98035..a54b90091 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -38,6 +38,8 @@ import textLink from "@/ux-components/text-link/text-link"; import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question"; import modal from "@/digital-components/modal/modal"; import alert from "@/ux-components/alert/alert"; +import store from "@/store"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "service-zip-modal-question", @@ -56,6 +58,10 @@ export default { zipCode: "", }), }, + mobileFeePart: { + type: Object, + default: () => ({}), + }, linkWidgetName: String, modalWidgetName: String, }, @@ -144,6 +150,16 @@ export default { } else { this.internalModel.state = zipCodeData.state; + // retrieve mobile fee part + const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = store.getters.payment.parentAccountNumber; + const billToAccountNumber = 1; + + const mobileFeePart = await getPricedMobileFeePart(this.internalModel.zipCode, serviceType, parentAccountNumber, billToAccountNumber); + + // emit it to parent + this.$emit("set-mobile-fee-part", mobileFeePart); + // Update the page level model this.$emit("update:modelValue", this.internalModel); diff --git a/src/store/index.js b/src/store/index.js index 64acea595..c4c43aab4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -918,7 +918,7 @@ export const actions = { getMobileFeePart(context) { return globalMethods.callMockHttpClient({ method: endpoints.GetMobileFeePart.method, - endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce", //TODO: Remove Mocky Endpoint + endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce?mocky-delay=3000ms", //TODO: Remove Mocky Endpoint }); },