From 0d06ce769f35a544a87f68aafcee44a6d9988695 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 22 May 2023 14:57:11 -0400 Subject: [PATCH 1/2] tech review updates --- .../location-alerts/location-alerts.vue | 53 +++++++++++++++++ src/layouts/schedule/schedule.vue | 58 +++---------------- 2 files changed, 62 insertions(+), 49 deletions(-) create mode 100644 src/layouts/schedule/location-alerts/location-alerts.vue diff --git a/src/layouts/schedule/location-alerts/location-alerts.vue b/src/layouts/schedule/location-alerts/location-alerts.vue new file mode 100644 index 000000000..0f8c7b46d --- /dev/null +++ b/src/layouts/schedule/location-alerts/location-alerts.vue @@ -0,0 +1,53 @@ + + diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 60fb90b75..ea782999d 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -18,17 +18,9 @@ - - + // Components -import alert from "@/ux-components/alert/alert"; import funnelHeader from "@/fmg-components/funnel-header/funnel-header"; import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer"; import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header"; import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import { Form, defineRule } from "vee-validate"; import datePicker from "@/digital-components/date-picker/date-picker"; +import locationAlerts from "@/layouts/schedule/location-alerts/location-alerts"; import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question"; // Supporting files @@ -77,7 +69,6 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; -import { getAlertReasons } from "@/layouts/schedule/helpers/schedule-helper"; import { doesCopyContainRouterLink, splitCopyOnCMSPlaceHolder, @@ -125,7 +116,6 @@ export default { selectedDate: null, selectedTimeSlotId: null, selectableDatesData: [], - weatherAlerts: [], mobileEarlyBirdFee: null, }; }, @@ -167,7 +157,9 @@ export default { const earlyBirdPromise = baseMixin.methods.dispatchStoreAction( storeActions.GET_MOBILE_EARLY_BIRD_FEE ); - const alertReasonsPromise = getAlertReasons(store.getters.order.serviceLocation.zipCodeCtu); + const alertReasonsPromise = locationAlerts.methods.loadInitialData( + store.getters.order.serviceLocation.zipCodeCtu + ); // Settle promises and get results const promiseResultMap = [ @@ -198,8 +190,8 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); - vm.setData(resultMap.alertReasons); vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData); + vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons); vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse; if (resultMap.earlyBird) { vm.mobileEarlyBirdFee = resultMap.pricingResults[0]; @@ -214,9 +206,6 @@ export default { // Splits content when brackets are found in text so that text can be looped through and router-link can be injected when needed return this.splitCopyOnCMSPlaceHolder(this.ChangeShopLinkText); }, - displayWeatherAlert() { - return this.weatherAlerts.length > 0; - }, appointmentType() { return this.$store.getters.order.serviceLocation.appointmentType; }, @@ -268,34 +257,6 @@ export default { ); return newShopTimeSlots; }, - setData(alertReasonsData) { - if (alertReasonsData) { - this.convertReasonsToCmsAlerts(alertReasonsData); - } - }, - cmsHeadlineTextFound(widgetName) { - return this.getCmsContent(widgetName, "HeadlineText") !== ""; - }, - convertReasonsToCmsAlerts(data) { - this.weatherAlerts = data.reduce((newObj, alert) => { - newObj.push({ - cmsWidgetName: `LocationAlert-${alert}`, - alertReason: alert, - }); - return newObj; - }, []); - }, - async getWeatherAlertReasons(ctu) { - await getAlertReasons(ctu) - .then((response) => { - if (response.data) { - this.convertReasonsToCmsAlerts(response.data); - } - }) - .catch(() => { - console.log("error fetching alert reasons.."); - }); - }, getServiceZipCtuCodeFromStore() { return store.getters.order.serviceLocation.zipCodeCtu; }, @@ -342,15 +303,14 @@ export default { }, }, components: { - alert, funnelHeader, funnelFooter, funnelSubHeader, Form, loadingModal, datePicker, + locationAlerts, timeSlotModalQuestion, }, - mounted() {}, }; From eac83dcfb07be17dde9b1d8b78de6fa66de1bf0b Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 22 May 2023 15:01:24 -0400 Subject: [PATCH 2/2] prettier --- src/layouts/schedule/schedule.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index ea782999d..d5e3b4c28 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -18,9 +18,7 @@ - +