From 63245465a8a947833071969d5f2a2ce6a951beaa Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Wed, 31 May 2023 11:44:57 -0400 Subject: [PATCH 1/2] CSR-1137 | Remove pre-emptive pricing call Added them in sequence to run together with the async group Also removed the logApiCall:false --- src/layouts/schedule/schedule.vue | 44 +++++++++++++------------------ src/store/index.js | 2 -- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 3a4290cb9..917613296 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -73,7 +73,7 @@ import { getRouterLinkRouteFromCopy, getRouterLinkDisplayTextFromCopy, } from "@/helpers/cms-content-helper"; -import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "./constants/schedule-constants"; +import { AppointmentTypeStrings } from "./constants/schedule-constants"; import { errorMessages } from "@/constants/error-messages"; import { required } from "@/helpers/validation-rules"; import store from "@/store"; @@ -146,24 +146,24 @@ export default { customSelectableDatesCallback: getAvailableDates, }); - // Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing - const pricingPromise = baseMixin.methods.dispatchStoreAction( - storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, - { - availableLineItems: [ - { - partNumber: PREMIUM_FEE_PART_TYPE, - partType: PREMIUM_FEE_PART_TYPE, - description: null, - }, - ], - }, - false - ); - const premiumFeePromise = baseMixin.methods.dispatchStoreAction( storeActions.GET_MOBILE_PREMIUM_FEE ); + + const premiumFeeWithPricePromise = premiumFeePromise.then(result => { + if (result.data) { + return baseMixin.methods.dispatchStoreAction( + storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, + { + availableLineItems: [result.data], + }, + false + ); + } else { + return result.data; + } + }); + const alertReasonsPromise = locationAlerts.methods.loadInitialData( store.getters.order.serviceLocation.zipCodeCtu ); @@ -182,12 +182,8 @@ export default { promise: datePickerInitialDataPromise, }, { - resultKey: "premiumFee", - promise: premiumFeePromise, - }, - { - resultKey: "pricingResults", - promise: pricingPromise, + resultKey: "premiumFeeWithPrice", + promise: premiumFeeWithPricePromise, }, ]; @@ -199,9 +195,7 @@ export default { vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData); vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons); vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse; - if (resultMap.premiumFee) { - vm.mobilePremiumAppointmentFee = resultMap.pricingResults[0]; - } + vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice ? resultMap.premiumFeeWithPrice[0] : null; }); }, computed: { diff --git a/src/store/index.js b/src/store/index.js index ee7ea4911..bb8ba2868 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1187,7 +1187,6 @@ export const actions = { method: endpoints.GetShopTimeSlots.method, endpoint: endpoints.GetShopTimeSlots.url, payload: payload, - logApiCall: false, }); }, @@ -1239,7 +1238,6 @@ export const actions = { method: endpoints.GetMobileTimeSlots.method, endpoint: endpoints.GetMobileTimeSlots.url, payload: payload, - logApiCall: false, }); }, From 122f9bffb5735cd54a379d475c8aeca61d752efe Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Wed, 31 May 2023 11:48:35 -0400 Subject: [PATCH 2/2] CSR-1137 | Formatting --- src/layouts/schedule/schedule.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 917613296..42775f476 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -150,7 +150,7 @@ export default { storeActions.GET_MOBILE_PREMIUM_FEE ); - const premiumFeeWithPricePromise = premiumFeePromise.then(result => { + const premiumFeeWithPricePromise = premiumFeePromise.then((result) => { if (result.data) { return baseMixin.methods.dispatchStoreAction( storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, @@ -195,7 +195,9 @@ export default { vm.$refs.datePicker.initializeComponent(resultMap.datePickerInitialData); vm.$refs.locationAlerts.initializeComponent(resultMap.alertReasons); vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse; - vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice ? resultMap.premiumFeeWithPrice[0] : null; + vm.mobilePremiumAppointmentFee = resultMap.premiumFeeWithPrice + ? resultMap.premiumFeeWithPrice[0] + : null; }); }, computed: {