From 9a3318b3fd71adc11d101cedd35a8988f64c5e6e Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 21 Sep 2023 10:11:44 -0400 Subject: [PATCH] Quote --- src/layouts/quote/quote.spec.js | 4 ++++ src/layouts/quote/quote.vue | 21 +++++++++++++++------ src/store/index.js | 12 +++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/layouts/quote/quote.spec.js b/src/layouts/quote/quote.spec.js index b4a3df9fb..60948bd52 100644 --- a/src/layouts/quote/quote.spec.js +++ b/src/layouts/quote/quote.spec.js @@ -36,6 +36,10 @@ jest.mock("@/mixins/base-mixin", () => ({ if (action === mockPriceOrderStoreAction) return items; else return mockStoreActionResults[action]; }, + dispatchStoreActionWithLogging(action, items, pageName, encode) { + if (action === mockPriceOrderStoreAction) return items; + else return mockStoreActionResults[action]; + }, getTierOnePackagePrice() { return mockTierOnePrice; }, diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 8a95d36cd..f8372a35a 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -86,12 +86,20 @@ export default { async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - const wipersPromise = baseMixin.methods.dispatchStoreAction(storeActions.GET_WIPERS); - const rainDefensePromise = baseMixin.methods.dispatchStoreAction( - storeActions.GET_RAIN_DEFENSE + const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging( + storeActions.GET_WIPERS, + null, + "quote" ); - const supportingItemsPromise = baseMixin.methods.dispatchStoreAction( - storeActions.GET_SUPPORTING_ITEMS + const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging( + storeActions.GET_RAIN_DEFENSE, + null, + "quote" + ); + const supportingItemsPromise = baseMixin.methods.dispatchStoreActionWithLogging( + storeActions.GET_SUPPORTING_ITEMS, + null, + "quote" ); const promiseResultMap = [ @@ -124,11 +132,12 @@ export default { ...clonedGlassParts, ]; - const pricingResults = await baseMixin.methods.dispatchStoreAction( + const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, { availableLineItems: availableLineItems, }, + "quote", false ); diff --git a/src/store/index.js b/src/store/index.js index 95ca50f1c..e468fc224 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1210,13 +1210,15 @@ export const actions = { return response; }, - getWipers(context) { + getWipers(context, { pageNameToLog }) { const carId = context.getters.vehicle.carId; const serviceZipCode = context.getters.order.serviceLocation.zipCode; return globalMethods .callHttpClient({ method: endpoints.GetWipers.method, endpoint: `${endpoints.GetWipers.url}/${carId}/${serviceZipCode}`, + logApiCall: true, + pageNameToLog: pageNameToLog, }) .catch((error) => { // The wiper service sometimes returns 500s on legitimate carId/zipCode combination - return empty array instead of breaking flow @@ -1224,10 +1226,12 @@ export const actions = { }); }, - getRainDefense(context) { + getRainDefense(context, { pageNameToLog }) { return globalMethods.callHttpClient({ method: endpoints.GetRainDefense.method, endpoint: endpoints.GetRainDefense.url, + logApiCall: true, + pageNameToLog: pageNameToLog, }); }, @@ -1959,7 +1963,7 @@ export const actions = { // Price order actions async priceOrderItemsAndSaveServerData( context, - { availableLineItems, serviceZipCode, serviceZipCodeCtu } + { payload: { availableLineItems, serviceZipCode, serviceZipCodeCtu }, pageNameToLog } ) { const zipCodeToUse = serviceZipCode ? serviceZipCode @@ -1999,6 +2003,8 @@ export const actions = { const response = await globalMethods.callHttpClient({ method: endpoints.PriceOrderItems.method, endpoint: `${endpoints.PriceOrderItems.url}?${queryString}`, + logApiCall: true, + pageNameToLog: pageNameToLog, }); context.commit(storeMutations.UPDATE_LINE_ITEMS_SERVER_DATA, response.data.serverData);