From dbb46c58e79ee26efcbdd3a10d2d4a6b0a58ced8 Mon Sep 17 00:00:00 2001 From: Josh Dassinger Date: Mon, 23 Feb 2026 09:55:36 -0600 Subject: [PATCH] INSR-8549 Fixed some edge cases Fixed logger not logging Error type correctly --- src/helpers/logger.js | 13 ++++++-- src/helpers/service-location-helper.js | 4 +-- src/layouts/schedule-page/schedule-page.vue | 16 +++++++--- .../mobile-location-modal-questions.vue | 3 +- src/store/index.js | 32 +++++++++---------- 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/helpers/logger.js b/src/helpers/logger.js index e4f23353..fc22939a 100644 --- a/src/helpers/logger.js +++ b/src/helpers/logger.js @@ -32,9 +32,16 @@ export class Logger { } formatLogEntry(message, details) { - return `Application: ${applicationConfig.APPLICATION_NAME}\n${message}\n${ - details ? JSON.stringify(details, undefined, 2) : '' - }`; + let json = ''; + if (details) { + if (details instanceof Error) { + json = JSON.stringify(details, Object.getOwnPropertyNames(details), 2); + } else { + json = JSON.stringify(details, undefined, 2) + } + } + + return `Application: ${applicationConfig.APPLICATION_NAME} \n${message} \n${json}`; } writeLogEntry(endpoint, logEntry) { diff --git a/src/helpers/service-location-helper.js b/src/helpers/service-location-helper.js index 8e4bb332..72572256 100644 --- a/src/helpers/service-location-helper.js +++ b/src/helpers/service-location-helper.js @@ -86,12 +86,12 @@ export async function onProviderChanged() { { resultKey: 'glassFees', promise: mainStore.getGlassFees() - .then(async (glassFees) => await mainStore.getCombinedQuote(glassFees)) + .then(async (glassFees) => await mainStore.getCombinedQuote(glassFees.data)) .then(async (quotedGlassFees) => mainStore.updateGlassFees(quotedGlassFees)) }, ]; - if (isMobileAppointment && (this.mainStore.isNoComp || this.mainStore.isITAC)) { + if (isMobileAppointment && (mainStore.isNoComp || mainStore.isITAC)) { promiseResultMap.push({ resultKey: 'priceMobileFee', promise: getPricedMobileFeePart(serviceZipCode).then(mobileFee => mainStore.updateMobileFee(mobileFee)) diff --git a/src/layouts/schedule-page/schedule-page.vue b/src/layouts/schedule-page/schedule-page.vue index ed488446..b9cb3ba3 100644 --- a/src/layouts/schedule-page/schedule-page.vue +++ b/src/layouts/schedule-page/schedule-page.vue @@ -225,7 +225,7 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); - const { isMobileAppointment, storeSelectedProvider, serviceZipCode } = getProviderData(); + const { isMobileAppointment, storeServiceLocation, storeSelectedProvider, serviceZipCode } = getProviderData(); const zipCodeData = getZipCodeData(serviceZipCode); const serviceabilityDetailsPromise = useMainStore().getServiceabilityDetails(serviceZipCode); const providersPromise = useMainStore().getSafeliteProviders(serviceZipCode, 150); @@ -647,7 +647,9 @@ export default { } }, mobileZipUpdatedFromServiceLocation(mobileZipServiceLocation) { - if (mobileZipServiceLocation) { + if (mobileZipServiceLocation + && (this.mobileProviderNumber !== mobileZipServiceLocation.mobileProviderNumber + || !this.hasNeededServiceLocationData)) { this.mobileProviderNumber = mobileZipServiceLocation.mobileProviderNumber; this.selectedMobileZipCode = mobileZipServiceLocation.zipCode; this.selectedServiceLocation = mobileZipServiceLocation; @@ -659,11 +661,15 @@ export default { }, async providerChangedFromServiceLocation(newProvider) { this.selectedProvider = newProvider?.provider; - if (newProvider?.refreshDatePicker && newProvider.provider) { - showIssLoadingModal(true); + if (newProvider?.provider) { this.mainStore.updateServiceLocation(newProvider); + showIssLoadingModal(true); await onProviderChanged(); - await this.refreshDatePicker(); + if (newProvider.refreshDatePicker) { + await this.refreshDatePicker(); + } else { + showIssLoadingModal(false); + } } }, async refreshDatePicker() { diff --git a/src/layouts/schedule-page/service-location/mobile-location-modal-question/mobile-location-modal-questions.vue b/src/layouts/schedule-page/service-location/mobile-location-modal-question/mobile-location-modal-questions.vue index cdeb25d2..97c7a600 100644 --- a/src/layouts/schedule-page/service-location/mobile-location-modal-question/mobile-location-modal-questions.vue +++ b/src/layouts/schedule-page/service-location/mobile-location-modal-question/mobile-location-modal-questions.vue @@ -88,7 +88,6 @@ import { useMainStore } from '@/store'; import { getMobileZipCodeData, getPricedMobileFeePart, - getServiceabilityDetails } from '@/helpers/service-location-helper'; import { deepClone } from '@/helpers/object-helper.js'; import vehicleProtectedQuestion from '@/layouts/schedule-page/service-location/mobile-location-modal-question/vehicle-protected-question/vehicle-protected-question.vue'; @@ -273,7 +272,7 @@ export default { const mobileFeePart = await getPricedMobileFeePart(serviceZipCode); // retrieve serviceability details - const serviceabilityDetails = await getServiceabilityDetails(serviceZipCode); + const serviceabilityDetails = await useMainStore().getServiceabilityDetails(serviceZipCode); // update content related to service zip code this.$emit('updated-mobile-fee-part', mobileFeePart); diff --git a/src/store/index.js b/src/store/index.js index 47362e02..b52d619e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1340,7 +1340,7 @@ export const useMainStore = defineStore({ }); }, - getServiceabilityDetails({ serviceZipCode }) { + getServiceabilityDetails(serviceZipCode) { const { vehicle, damage, parentAccountNumber, referralSequenceNumber, lineItems } = this.order; const { carId } = vehicle; const glassArray = convertGlassPieceNamingForApi(damage.glassToReplace); @@ -1842,26 +1842,26 @@ export const useMainStore = defineStore({ this.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu ?? this.order.serviceLocation.zipCodeCtu; this.order.serviceLocation.appointmentType = serviceLocationInfo.appointmentType ?? this.order.serviceLocation.appointmentType; this.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected ?? this.order.serviceLocation.isVehicleProtected; - - if (serviceLocationInfo.provider) { - this.order.serviceLocation.provider = { - providerNumber: serviceLocationInfo.provider?.providerNumber, - address: { - streetAddress: serviceLocationInfo.provider?.address?.streetAddress, - city: serviceLocationInfo.provider?.address?.city, - state: serviceLocationInfo.provider?.address?.state, - zipCode: serviceLocationInfo.provider?.address?.zipCode, - zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu - }, - companyName: serviceLocationInfo.provider?.companyName, - phoneNumber: serviceLocationInfo.provider?.phoneNumber - }; - } + this.updateServiceLocationProvider(serviceLocationInfo.provider) this.order.serviceLocation.tpaSearchRadius = serviceLocationInfo.tpaSearchRadius; }, updateAppointmentType(appointmentType) { this.order.serviceLocation.appointmentType = appointmentType; }, + updateServiceLocationProvider(providerInfo) { + this.order.serviceLocation.provider = { + providerNumber: providerInfo?.providerNumber, + address: { + streetAddress: providerInfo?.address?.streetAddress, + city: providerInfo?.address?.city, + state: providerInfo?.address?.state, + zipCode: providerInfo?.address?.zipCode, + zipCodeCtu: providerInfo?.address?.zipCodeCtu + }, + companyName: providerInfo?.companyName, + phoneNumber: providerInfo?.phoneNumber + }; + }, resetState() { Object.assign(this, getDefaultState()); },