From e104a3688611272740a2ef9014e072092f919ef3 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 24 Oct 2023 14:43:18 -0400 Subject: [PATCH 01/25] CSR-1384: set up modals --- .../add-vaps-modal-buttons.vue | 173 +++++++++++++++--- 1 file changed, 149 insertions(+), 24 deletions(-) diff --git a/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue index 3fc426d63..b02444f24 100644 --- a/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue +++ b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue @@ -3,30 +3,49 @@
-

{{ rainDefenseItem.listPrice }}

+

+${{ rainDefenseItem.listPrice }}

-

{{ wipersItem.listPrice }}

+
+
+ +

+${{ wipersItem.totalFrontPrice }}

+
+ +
+ +

+${{ wipersItem.totalRearPrice }}

+
+
+
+

+${{ wipersItem.totalFrontPrice }}

+
@@ -36,6 +55,7 @@ import buttonQuestion from "@/digital-components/button-question/button-question"; import addVapsButton from "./add-vaps-button/add-vaps-button"; import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal"; +import checkboxQuestion from "@/digital-components/checkbox-question/checkbox-question"; export default { name: "add-vaps-modal-buttons", @@ -47,26 +67,47 @@ export default { data() { return { addVapsButton: addVapsButton, + selectedFrontWipers: null, + selectedRearWipers: null, }; }, methods: { openModal(modalName) { this.$refs[modalName].openModal(); }, - addToCart(modalName, part) { - const vapsItems = this.currentCartItems.vaps; - const alreadyInVaps = vapsItems.some((item) => { + addRainDefenseToCart(modalName, part) { + const alreadyInVaps = this.currentCartItems.vaps.some((item) => { return item.partType === part.partType; }); if (!alreadyInVaps) { - if (part.subItems) { - // for wipers, a "combined" part (w/ subItems) - part.subItems.forEach((part) => { + this.currentCartItems.vaps.push(part); + } + this.$refs[modalName].closeModal(); + }, + addWipersToCart(modalName, part) { + const frontWipersAlreadyInVaps = this.currentCartItems.vaps.some((item) => { + return item.partType === part.frontWiperLineItems[0].partType; + }); + const rearWipersAlreadyInVaps = this.currentCartItems.vaps.some((item) => { + return item.partType === part.rearWiperLineItems[0]?.partType; + }); + + if (!this.wipersItem.priceRangeText?.length > 0) { + this.selectedFrontWipers = true; // set as true if front wipers is only option + } + if (!frontWipersAlreadyInVaps && this.selectedFrontWipers) { + if (part.frontWiperLineItems) { + // for wipers, a "combined" part (frontWiperLineItems) + part.frontWiperLineItems.forEach((part) => { + this.currentCartItems.vaps.push(part); + }); + } + } + if (!rearWipersAlreadyInVaps && this.selectedRearWipers) { + if (part.rearWiperLineItems) { + part.rearWiperLineItems.forEach((part) => { this.currentCartItems.vaps.push(part); }); - } else { - // for rain defense, a "single" part (w/o subItems) - this.currentCartItems.vaps.push(part); } } this.$refs[modalName].closeModal(); @@ -107,25 +148,46 @@ export default { return item.partType.includes("WIPER"); }); let wiperLineItem; + if (wiperLineItems.length === 1) { wiperLineItem = wiperLineItems[0]; - wiperLineItem.listPrice = parseFloat( + wiperLineItem.totalFrontPrice = parseFloat( wiperLineItem.laborAmount + wiperLineItem.sellingPrice + wiperLineItem.kitPrice ).toFixed(2); return wiperLineItem; } else if (wiperLineItems.length > 1) { - let combinedPrice = 0; + let totalFrontPrice = 0; + let totalRearPrice = 0; wiperLineItems?.forEach((item) => { - combinedPrice += item?.laborAmount + item?.sellingPrice + item?.kitPrice; + if (item.partType === "REAR WIPER") { + totalRearPrice += item?.laborAmount + item?.sellingPrice + item?.kitPrice; + } else { + totalFrontPrice += item?.laborAmount + item?.sellingPrice + item?.kitPrice; + } }); wiperLineItem = { description: "COMBINED ITEM", partType: "WIPERS", - subItems: [], - listPrice: parseFloat(combinedPrice).toFixed(2), + frontWiperLineItems: [], + rearWiperLineItems: [], + totalFrontPrice: parseFloat(totalFrontPrice).toFixed(2), + totalRearPrice: parseFloat(totalRearPrice).toFixed(2), + priceRangeText: "", }; wiperLineItems?.forEach((item) => { - wiperLineItem.subItems.push(item); + if (item.partType === "REAR WIPER") { + wiperLineItem.rearWiperLineItems.push(item); + const priceRanges = [ + totalFrontPrice, + totalRearPrice, + totalFrontPrice + totalRearPrice, + ]; + priceRanges.sort((a, b) => a - b); + wiperLineItem.priceRangeText = + "+$" + priceRanges[0] + " - $" + priceRanges[priceRanges.length - 1]; + } else { + wiperLineItem.frontWiperLineItems.push(item); + } }); return wiperLineItem; } @@ -134,7 +196,7 @@ export default { answersCmsData() { return this.getCmsContent(this.vapsTilesCmsName, "Answers"); }, - answersToDisplay() { + buttonsToDisplay() { const answers = []; if (!this.answersCmsData) return answers; const getAnswer = (name, answers) => { @@ -145,7 +207,11 @@ export default { }; if (this.showAddWipers) { const answer = getAnswer("WipersModal", this.answersCmsData); - answer.SubText = "+$" + this.wipersItem.listPrice; + if (this.wipersItem.priceRangeText?.length > 0) { + answer.SubText = this.wipersItem.priceRangeText; + } else { + answer.SubText = "+$" + this.wipersItem.totalFrontPrice; + } answers.push(answer); } if (this.showAddRainDefense) { @@ -159,6 +225,65 @@ export default { components: { buttonQuestion, contentGroupModal, + checkboxQuestion, }, }; + + From 75b47e2ebd7f0ef8d78e5d53149e39951d82ff33 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 25 Oct 2023 11:29:47 -0400 Subject: [PATCH 02/25] Actually key into experiment setting --- src/layouts/payment-method/payment-method.vue | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index f72784abb..19034c1ad 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -353,11 +353,8 @@ export default { isPiaDisabled() { const piaExperience = this.getSettingValue(experimentSettings.PIA_EXPERIENCE) === "PIA Optional"; - const enablePIA = - this.getSettingValue(experimentSettings.SUBMIT_ORDER_ENABLE_PIA) === "true"; - return false; - //return !(piaExperience && enablePIA); + return !piaExperience; }, paymentMethod() { if (this.isPiaDisabled) { From fb783ee7ddede8ae01936db4a6a1f60c8809000b Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:09:18 -0400 Subject: [PATCH 03/25] CSR-1392 use router params instead of store to save pia error --- src/constants/store-actions.js | 1 - src/constants/store-mutations.js | 1 - .../payment-method/payment-method.spec.js | 5 --- src/layouts/payment-method/payment-method.vue | 11 ++---- .../payment-pia-return/payment-pia-return.vue | 34 ++++++++----------- src/layouts/payment/payment.vue | 4 --- src/router/router-constants/router-params.js | 1 + src/store/index.js | 7 ---- 8 files changed, 19 insertions(+), 45 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 64e6df3aa..ee67ff77d 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -90,7 +90,6 @@ const storeActions = { SAVE_CUSTOMER_DETAILS: "saveCustomerDetails", SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes", SAVE_WORK_ORDER_FLAG: "saveWorkOrderFlag", - SAVE_PIA_ERROR_CODE: "savePiaErrorCode", SAVE_PIA_WORK_ORDER: "savePiaWorkOrder", SAVE_CCTOKEN: "saveCCToken", SAVE_PAYPAL_TOKEN: "savePaypalToken", diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index 9e2e30a14..ca0afadf2 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -1,7 +1,6 @@ const storeMutations = { // PAYMENT MUTATIONS UPDATE_WORK_ORDER_FLAG: "updateWorkOrderFlag", - UPDATE_PIA_ERROR_CODE: "updatePiaErrorCode", UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder", UPDATE_CCTOKEN: "updateCCToken", UPDATE_PAYPAL_TOKEN: "updatePaypalToken", diff --git a/src/layouts/payment-method/payment-method.spec.js b/src/layouts/payment-method/payment-method.spec.js index 803f10829..88112ba37 100644 --- a/src/layouts/payment-method/payment-method.spec.js +++ b/src/layouts/payment-method/payment-method.spec.js @@ -48,11 +48,6 @@ function setupMocks() { store.getters = { damage: {}, lineItems: [], - order: { - payment: { - piaErrorCode: "", - }, - }, }; const mountOptions = getMountOptions({ diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index f72784abb..0c966fafb 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -35,7 +35,7 @@ @@ -275,7 +275,6 @@ export default { }); }, backButtonAction() { - this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); }, async forwardButtonAction() { @@ -300,7 +299,6 @@ export default { this.piaSetup(this.paymentMethod); break; default: - this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false); await submitWorkOrder({ pageNameToLog: "payment-method" }); this.$router.navigateWithoutSaving( @@ -315,9 +313,6 @@ export default { // since we're leaving the site for pia, clear any save session promises that we will not be able to resolve when we return await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); - // make sure pia error codes are reset - this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); - // if we don't have a work order in delete substatus, set the flag and submit if (!store.getters.order.workOrderNumber) { this.dispatchStoreAction(storeActions.SAVE_PIA_WORK_ORDER, true); @@ -366,8 +361,8 @@ export default { return this.paymentMethodInternalModel; }, - displayPiaAlert() { - return store.getters.order.payment.piaErrorCode ? true : false; + shouldDisplayPiaAlert() { + return this.$route.params[this.routerParams.DISPLAY_PIA_ALERT]; }, }, watch: { diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index aa9340995..4128ef9d1 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -14,6 +14,7 @@ import baseMixin from "@/mixins/base-mixin.js"; import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import { Form } from "vee-validate"; import { paymentMethods } from "@/constants/payment-method-constants"; +import { routerParams } from "@/router/router-constants/router-params"; export default { name: "payment-pia-return", @@ -23,12 +24,12 @@ export default { if (piaError) { console.log("Error during payment: " + piaError); - baseMixin.methods.dispatchStoreAction( - storeActions.SAVE_PIA_ERROR_CODE, - piaError, - false + this.$router.navigateWithoutSaving( + this.navigationScenarios.PIA_ERROR, + this.$route, + {}, + { [routerParams.DISPLAY_PIA_ALERT]: true } ); - this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route); } else { switch (store.getters.order.payment.piaType) { case paymentMethods.CREDIT_CARD: @@ -41,14 +42,11 @@ export default { default: var msg = "Unknown Pia type: " + store.getters.order.payment.piaType; console.log(msg); - baseMixin.methods.dispatchStoreAction( - storeActions.SAVE_PIA_ERROR_CODE, - msg, - false - ); this.$router.navigateWithoutSaving( this.navigationScenarios.PIA_ERROR, - this.$route + this.$route, + {}, + { [routerParams.DISPLAY_PIA_ALERT]: true } ); } } @@ -60,7 +58,6 @@ export default { async processPaypalResponse() { const token = getQuerystringParameter(queryStrings.TOKEN); const payerId = getQuerystringParameter(queryStrings.PAYERID); - baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PAYPAL_TOKEN, token, false); @@ -68,7 +65,6 @@ export default { }, async processCreditCardResponse() { const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); - baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, null, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); const referralSeqNum = getQuerystringParameter(queryStrings.REFERRAL_SEQ_NUM); @@ -79,12 +75,12 @@ export default { " " + store.getters.order.referralSequenceNumber ); - baseMixin.methods.dispatchStoreAction( - storeActions.SAVE_PIA_ERROR_CODE, - "unknown error", - false - ); - this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route); + this.$router.navigateWithoutSaving( + this.navigationScenarios.PIA_ERROR, + this.$route, + {}, + { [routerParams.DISPLAY_PIA_ALERT]: true } + ); } else { const expMonth = getQuerystringParameter(queryStrings.CARD_EXPIRATION_MONTH); const expYear = getQuerystringParameter(queryStrings.CARD_EXPIRATION_YEAR); diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 3750039f7..eb667a7ba 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -246,8 +246,6 @@ export default { return items[1]; } - // no work order, set pia error and return - this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, "NO WORK ORDER", false); this.backButtonAction(); }, getInvoiceNumber() { @@ -255,8 +253,6 @@ export default { return store.getters.order.workOrderNumber.replace("-", ""); } - // no work order, set pia error and return - this.dispatchStoreAction(storeActions.SAVE_PIA_ERROR_CODE, "NO WORK ORDER", false); this.backButtonAction(); }, getAddress1() { diff --git a/src/router/router-constants/router-params.js b/src/router/router-constants/router-params.js index 3bebdc33e..ae7b88283 100644 --- a/src/router/router-constants/router-params.js +++ b/src/router/router-constants/router-params.js @@ -1,5 +1,6 @@ const routerParams = { DISPLAY_VEHICLE_CHANGE_ALERT: "displayVehicleChangeAlert", + DISPLAY_PIA_ALERT: "displayPiaAlert", }; export { routerParams }; diff --git a/src/store/index.js b/src/store/index.js index 87221dbc3..8094e0f8d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -97,7 +97,6 @@ const getDefaultState = () => { parentAccountNumber: 0, isPia: null, piaType: null, - piaErrorCode: null, inactivePromos: null, paypalToken: null, ccToken: { @@ -249,9 +248,6 @@ export const mutations = { updatePiaType(state, piaType) { state.order.payment.piaType = piaType; }, - updatePiaErrorCode(state, piaErrorCode) { - state.order.payment.piaErrorCode = piaErrorCode; - }, updatePiaWorkOrder(state, piaWorkOrder) { state.order.createDeleteStatusWorkOrderForPia = piaWorkOrder; }, @@ -1779,9 +1775,6 @@ export const actions = { saveWorkOrderFlag(context, submitAfterSave) { context.commit(storeMutations.UPDATE_WORK_ORDER_FLAG, submitAfterSave); }, - savePiaErrorCode(context, piaErrorCode) { - context.commit(storeMutations.UPDATE_PIA_ERROR_CODE, piaErrorCode); - }, savePiaWorkOrder(context, piaWorkOrder) { context.commit(storeMutations.UPDATE_PIA_WORK_ORDER, piaWorkOrder); }, From f6bdd4a2724512dec65be0e103f20bb333f2b487 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Wed, 25 Oct 2023 15:19:19 -0400 Subject: [PATCH 04/25] CSR-1392 unused parm passed to setupPia. --- src/layouts/payment-method/payment-method.vue | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index e661a58b3..188078781 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -288,26 +288,19 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_PROMOS, this.lineItems.promos, false); - switch (this.paymentMethod) { - case paymentMethods.CREDIT_CARD: - this.setupPia(this.paymentMethod); - break; - case paymentMethods.PAYPAL: - this.setupPia(this.paymentMethod); - break; - case paymentMethods.AFTERPAY: - this.setupPia(this.paymentMethod); - break; - default: - this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false); + if (this.paymentMethod == paymentMethods.LATER) { + this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false); await submitWorkOrder({ pageNameToLog: "payment-method" }); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_FORWARD, this.$route ); } + else { + this.setupPia(); + } }, - async setupPia(payNowType) { + async setupPia() { this.$refs.loadingModal.showModal(); // since we're leaving the site for pia, clear any save session promises that we will not be able to resolve when we return From f687e1a8036ac1646bda64856bc94748344424ef Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Wed, 25 Oct 2023 16:44:16 -0400 Subject: [PATCH 05/25] Payment page style updates. --- public/css/hop-styling.css | 12 ++++++------ public/css/hop-styling.scss | 22 ++++++++++++---------- src/layouts/payment/payment.vue | 4 +--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/public/css/hop-styling.css b/public/css/hop-styling.css index ded3578c8..1f0b0ddc2 100644 --- a/public/css/hop-styling.css +++ b/public/css/hop-styling.css @@ -15,6 +15,7 @@ body .validation-info { } body .italicSmall { font-style: normal; + font-size: 14px; } body span { line-height: 24px; @@ -27,7 +28,7 @@ body .form-group { display: flex; flex-direction: column; } -body h2 { +body .headerlinecontainer .headerline1 { font-size: 20px; line-height: 32px; font-weight: 400; @@ -76,12 +77,12 @@ body .creditCardSpecific div { body .creditCardSpecific div .headerlinecontainer { padding: 0; } -body .creditCardSpecific div .headerlinecontainer .headerline5v2 { - display: none; -} body .creditCardSpecific div label { font-weight: 500; } +body .creditCardSpecific div:first-child { + display: none; +} body .creditCardSpecific #infoRow2 { margin-bottom: 0; } @@ -91,7 +92,7 @@ body #cardExpirationContainer { justify-content: space-between; padding: 0; } -@media (min-width: 368px) { +@media (min-width: 400px) { body #cardExpirationContainer { flex-direction: row; } @@ -116,7 +117,6 @@ body .optional-label:after { } body .buttonContainer { height: 48px; - margin-top: 36px; } body .buttonContainer button { position: relative; diff --git a/public/css/hop-styling.scss b/public/css/hop-styling.scss index 81b798b78..0e646a591 100644 --- a/public/css/hop-styling.scss +++ b/public/css/hop-styling.scss @@ -16,6 +16,7 @@ body { .italicSmall { font-style: normal; + font-size: 14px; } span { @@ -32,11 +33,13 @@ body { flex-direction: column; } - h2 { - font-size: 20px; - line-height: 32px; - font-weight: 400; - margin: 24px 0; + .headerlinecontainer { + .headerline1 { + font-size: 20px; + line-height: 32px; + font-weight: 400; + margin: 24px 0; + } } input, @@ -86,13 +89,13 @@ body { padding: 8px 0; .headerlinecontainer { padding: 0; - .headerline5v2 { - display: none; - } } label { font-weight: 500; } + &:first-child { + display: none; + } } #infoRow2 { margin-bottom: 0; @@ -104,7 +107,7 @@ body { flex-direction: column; justify-content: space-between; padding: 0; - @media (min-width: 368px) { + @media (min-width: 400px) { flex-direction: row; .card_expirationYear, .card_expirationMonth { @@ -132,7 +135,6 @@ body { .buttonContainer { height: 48px; - margin-top: 36px; button { position: relative; background: linear-gradient(270deg, #1574a1 0%, #003d58 100%); diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 2d7b1248e..b8aee6a99 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -20,14 +20,12 @@ scrolling="no"> -
-
@@ -387,7 +385,7 @@ export default { From 4bbc508aade4af1fe95bb85f518aac7e5bb257ac Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 27 Oct 2023 16:40:24 -0400 Subject: [PATCH 21/25] CSR-1384: minor alts to insure against console errors --- .../add-vaps-modal-buttons.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue index d2195c5e5..0c7976ea8 100644 --- a/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue +++ b/src/layouts/payment-method/add-vaps-modal-buttons/add-vaps-modal-buttons.vue @@ -215,17 +215,17 @@ export default { if (!rainDefenseInCart) { // NO RAIN DEFENSE IN CART; SHOW RAIN DEFENSE BUTTON const modalData = getAnswer("RainDefenseModal", this.answersCmsData); - modalData.SubText = "+$" + this.rainDefenseModal.listPrice; + modalData.SubText = "+$" + this.rainDefenseModal?.listPrice; buttons.push(modalData); } const modalData = getAnswer("WipersModal", this.answersCmsData); if (!frontWipersInCart) { - if (!rearWipersInCart && this.wipersModal.rearWiperLineItems.length > 0) { + if (!rearWipersInCart && this.wipersModal?.rearWiperLineItems.length > 0) { // NO REAR WIPERS or FRONT WIPERS IN CART; SHOW COMBO BUTTON const prices = [ - this.wipersModal.totalFrontPrice, - this.wipersModal.totalRearPrice, + this.wipersModal?.totalFrontPrice, + this.wipersModal?.totalRearPrice, ]; prices.sort((a, b) => a - b); modalData.SubText = "+$" + prices[0] + " - $" + prices[prices.length - 1]; @@ -233,13 +233,13 @@ export default { buttons.push(modalData); } else { // NO FRONT WIPERS IN CART; SHOW ONLY FRONT WIPERS BUTTON - modalData.SubText = "+$" + this.wipersModal.totalFrontPrice; + modalData.SubText = "+$" + this.wipersModal?.totalFrontPrice; this.updateWipersToDisplay(wipersToDisplayStrings.FRONT); buttons.push(modalData); } - } else if (!rearWipersInCart && this.wipersModal.rearWiperLineItems.length > 0) { + } else if (!rearWipersInCart && this.wipersModal?.rearWiperLineItems.length > 0) { // NO REAR WIPERS IN CART; SHOW ONLY REAR WIPERS BUTTON - modalData.SubText = "+$" + this.wipersModal.totalRearPrice; + modalData.SubText = "+$" + this.wipersModal?.totalRearPrice; this.updateWipersToDisplay(wipersToDisplayStrings.REAR); buttons.push(modalData); } From 166940db044aaec4f461ab2e419247bfdc03e8e6 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Sun, 29 Oct 2023 08:28:32 -0400 Subject: [PATCH 22/25] CSR-1392 removed work order flags for submitting a pia in delete substatus and the final submit flag from the store and pass it as a parameter to save session instead. --- src/constants/store-actions.js | 2 - src/constants/store-mutations.js | 2 - .../heritage-integration/order-helper.js | 38 ++++++++++++++++--- src/layouts/payment-method/payment-method.vue | 26 +++++++++---- .../payment-pia-return/payment-pia-return.vue | 20 ++++++++-- src/store/index.js | 26 ++++--------- src/store/store.spec.js | 11 ------ 7 files changed, 74 insertions(+), 51 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index ee67ff77d..bb2ef16a0 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -89,8 +89,6 @@ const storeActions = { SAVE_PROMOS: "savePromos", SAVE_CUSTOMER_DETAILS: "saveCustomerDetails", SAVE_SERVICE_LOCATION_TECH_NOTES: "saveServiceLocationTechNotes", - SAVE_WORK_ORDER_FLAG: "saveWorkOrderFlag", - SAVE_PIA_WORK_ORDER: "savePiaWorkOrder", SAVE_CCTOKEN: "saveCCToken", SAVE_PAYPAL_TOKEN: "savePaypalToken", }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index ca0afadf2..b7ac47d38 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -1,7 +1,5 @@ const storeMutations = { // PAYMENT MUTATIONS - UPDATE_WORK_ORDER_FLAG: "updateWorkOrderFlag", - UPDATE_PIA_WORK_ORDER: "updatePiaWorkOrder", UPDATE_CCTOKEN: "updateCCToken", UPDATE_PAYPAL_TOKEN: "updatePaypalToken", diff --git a/src/helpers/heritage-integration/order-helper.js b/src/helpers/heritage-integration/order-helper.js index 91f4768f3..01a5a780f 100644 --- a/src/helpers/heritage-integration/order-helper.js +++ b/src/helpers/heritage-integration/order-helper.js @@ -53,17 +53,30 @@ export async function loadSessionIfPresent(isConceptInsurance, pageNameToLog) { This will also set Referral information in the store after saving, and then update the cookie. To force synchronous behavior pass in 'true' for shouldAwaitSaveSessionQueue */ -export async function saveSession({ pageNameToLog, shouldAwaitSaveSessionQueue = false }) { +export async function saveSession({ + pageNameToLog, + shouldAwaitSaveSessionQueue = false, + submitAfterSave = false, + createDeleteStatusWorkOrderForPia = false, +}) { var saveSessionPromise; if (store.getters.applicationUser.saveSessionPromise) { // queue newest request after current saveSessionPromise resolves saveSessionPromise = store.getters.applicationUser.saveSessionPromise.then(() => { // get a new saveSessionPromise - return saveSessionHelper(pageNameToLog); + return saveSessionHelper( + pageNameToLog, + submitAfterSave, + createDeleteStatusWorkOrderForPia + ); }); } else { // create an initial saveSessionPromise - saveSessionPromise = saveSessionHelper(pageNameToLog); + saveSessionPromise = saveSessionHelper( + pageNameToLog, + submitAfterSave, + createDeleteStatusWorkOrderForPia + ); } store.commit(storeMutations.UPDATE_SAVE_SESSION_PROMISE, saveSessionPromise); // await here to allow for a caller to await and make the function synchronous @@ -72,10 +85,16 @@ export async function saveSession({ pageNameToLog, shouldAwaitSaveSessionQueue = } } -export async function submitWorkOrder({ pageNameToLog }) { +export async function submitWorkOrder({ + pageNameToLog, + submitAfterSave = false, + createDeleteStatusWorkOrderForPia = false, +}) { await saveSession({ pageNameToLog: pageNameToLog, shouldAwaitSaveSessionQueue: true, + submitAfterSave: submitAfterSave, + createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, }); } @@ -117,10 +136,17 @@ async function loadSession( /* Encapsulates asynchronous Save Session logic inside a promise to allow for Save Session queuing */ -async function saveSessionHelper(pageNameToLog) { +async function saveSessionHelper( + pageNameToLog, + submitAfterSave = false, + createDeleteStatusWorkOrderForPia = false +) { const savedSessionInfo = await baseMixin.methods.dispatchStoreActionWithLogging( storeActions.SAVE_SESSION, - null, + { + submitAfterSave: submitAfterSave, + createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, + }, pageNameToLog ); // Update the store with information received from the saveSession response diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index a3044994b..5d013c97d 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -266,7 +266,6 @@ export default { const matchedIndices = []; this.cartItems.forEach((cartItem, i) => { if (cartItem.partType === item.partType) { - // console.log("adding this to matchedIndices: ", i); matchedIndices.push(i); } }); @@ -289,8 +288,8 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_PROMOS, this.lineItems.promos, false); if (this.paymentMethod == paymentMethods.LATER) { - this.dispatchStoreAction(this.storeActions.SAVE_WORK_ORDER_FLAG, true, false); - await submitWorkOrder({ pageNameToLog: "payment-method" }); + // this creates the final work order + await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true }); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_FORWARD, this.$route @@ -302,14 +301,25 @@ export default { async setupPia() { this.$refs.loadingModal.showModal(); - // if we don't have a work order in delete substatus, set the flag and submit + // if we don't have a work order in delete substatus, set the flag and submit. + // we need a work order number for pia so we can pass it to safeliteHop. if (!store.getters.order.workOrderNumber) { - this.dispatchStoreAction(storeActions.SAVE_PIA_WORK_ORDER, true); - await submitWorkOrder({ pageNameToLog: "payment-method" }); - this.dispatchStoreAction(storeActions.SAVE_PIA_WORK_ORDER, false); - this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); + try { + await submitWorkOrder({ + pageNameToLog: "payment-method", + submitAfterSave: false, + createDeleteStatusWorkOrderForPia: true, + }); + } catch (error) { + console.log( + "error: response from pia submit work order:" + error.message); + this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); + this.$route.params[this.routerParams.DISPLAY_PIA_ALERT] = true; + return; + } } + this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); this.$router.navigateWithoutSaving( this.navigationScenarios.CLICKED_PAY_NOW, this.$route diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index 3eb819810..54e49c620 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -58,14 +58,12 @@ export default { async processPaypalResponse() { const token = getQuerystringParameter(queryStrings.TOKEN); const payerId = getQuerystringParameter(queryStrings.PAYERID); - baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); baseMixin.methods.dispatchStoreAction(storeActions.SAVE_PAYPAL_TOKEN, token, false); await this.saveAndSubmitWorkOrder(); }, async processCreditCardResponse() { const subscriptionID = getQuerystringParameter(queryStrings.SUBSCRIPTIONID); - baseMixin.methods.dispatchStoreAction(storeActions.SAVE_WORK_ORDER_FLAG, true, false); const referralSeqNum = getQuerystringParameter(queryStrings.REFERRAL_SEQ_NUM); if (referralSeqNum != store.getters.order.referralSequenceNumber) { @@ -115,7 +113,23 @@ export default { async saveAndSubmitWorkOrder() { // Final work order submit after returning from PIA. await this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); - await submitWorkOrder({ pageNameToLog: "payment-pia-return" }); + try { + await submitWorkOrder({ + pageNameToLog: "payment-pia-return", + submitAfterSave: true, + }); + } catch (error) { + console.log("error: response from submit work order:" + error.message); + this.$router.navigateWithoutSaving( + this.navigationScenarios.PIA_ERROR, + this.$route, + {}, + { [routerParams.DISPLAY_PIA_ALERT]: true } + ); + this.$refs.loadingModal.isModalVisible = false; + return; + } + this.$refs.loadingModal.isModalVisible = false; this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_SUCCESS, this.$route); }, diff --git a/src/store/index.js b/src/store/index.js index 64640bca2..72fcb264e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -28,7 +28,6 @@ import { getDateDifferenceInDays } from "@/helpers/date-helper"; // Export State const getDefaultState = () => { return { - submitAfterSave: false, order: { vehicle: { year: null, @@ -127,7 +126,6 @@ const getDefaultState = () => { referralCorrelationId: null, eon: null, workOrderNumber: null, - createDeleteStatusWorkOrderForPia: false, }, applicationUser: { eventBus: [], @@ -147,10 +145,6 @@ export const state = getDefaultState(); // Export Mutations export const mutations = { - updateWorkOrderFlag(state, submitAfterSave) { - state.submitAfterSave = submitAfterSave; - }, - // VEHICLE MUTATIONS updateYear(state, year) { state.order.vehicle.year = year; @@ -248,9 +242,6 @@ export const mutations = { updatePiaType(state, piaType) { state.order.payment.piaType = piaType; }, - updatePiaWorkOrder(state, piaWorkOrder) { - state.order.createDeleteStatusWorkOrderForPia = piaWorkOrder; - }, updateWorkOrderNumber(state, workOrderNumber) { state.order.workOrderNumber = workOrderNumber; }, @@ -566,7 +557,6 @@ export const mutations = { // Export Getters export const getters = { - submitAfterSave: (state) => state.submitAfterSave, vehicle: (state) => state.order.vehicle, eventBusItem: (state) => (eventCategory, eventSubCategory) => { const matchedEvent = state.applicationUser.eventBus.find( @@ -1577,13 +1567,17 @@ export const actions = { }, // Session API Actions - saveSession(context, { pageNameToLog }) { + saveSession(context, { pageNameToLog, payload }) { const vehicle = context.getters.vehicle; const damage = context.getters.damage; const order = context.state.order; const applicationUser = context.getters.applicationUser; const lineItems = context.state.order.lineItems; + const submitAfterSave = payload?.submitAfterSave === "true"; + const createDeleteStatusWorkOrderForPia = + payload?.createDeleteStatusWorkOrderForPia === "true"; + // create a new array to avoid mutating state const newGlassToReplace = convertGlassPieceNamingForApi(damage.glassToReplace); @@ -1591,7 +1585,7 @@ export const actions = { method: endpoints.SaveSession.method, endpoint: endpoints.SaveSession.url, payload: { - submitAfterSave: context.state.submitAfterSave, + submitAfterSave: submitAfterSave, userAgent: navigator.userAgent, applicationUser: { crmCustomerId: applicationUser.crmCustomerId, @@ -1702,7 +1696,7 @@ export const actions = { referralNumber: order.referralNumber?.toString(), referralSequenceNumber: order.referralSequenceNumber, eon: order.eon, - createDeleteStatusWorkOrderForPia: order.createDeleteStatusWorkOrderForPia, + createDeleteStatusWorkOrderForPia: createDeleteStatusWorkOrderForPia, }, }, logApiCall: true, @@ -1773,12 +1767,6 @@ export const actions = { ); }, - saveWorkOrderFlag(context, submitAfterSave) { - context.commit(storeMutations.UPDATE_WORK_ORDER_FLAG, submitAfterSave); - }, - savePiaWorkOrder(context, piaWorkOrder) { - context.commit(storeMutations.UPDATE_PIA_WORK_ORDER, piaWorkOrder); - }, saveCCToken(context, ccToken) { context.commit(storeMutations.UPDATE_CCTOKEN, ccToken); }, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index b0cd5154a..e7c004090 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -2791,17 +2791,6 @@ describe("Actions", () => { }); describe("Getters", () => { - it("submitAfterSave, should return true", () => { - // Arrange - const storeState = state; - - // Act - mutations.updateWorkOrderFlag(storeState, true); - - // Assert - expect(getters.submitAfterSave(storeState)).toEqual(true); - }); - it("Vehicle getter, should return vehicle data", () => { // Arrange const storeState = state; From 0d9373cae72d6144f765e71fd90659dcc031c609 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Sun, 29 Oct 2023 08:33:17 -0400 Subject: [PATCH 23/25] CSR-1392 prettier --- src/layouts/payment-method/payment-method.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 5d013c97d..46fc1b55e 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -311,8 +311,7 @@ export default { createDeleteStatusWorkOrderForPia: true, }); } catch (error) { - console.log( - "error: response from pia submit work order:" + error.message); + console.log("error: response from pia submit work order:" + error.message); this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE); this.$route.params[this.routerParams.DISPLAY_PIA_ALERT] = true; return; From df0c0435af700871e16015e52c49e6d140352ea1 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Sun, 29 Oct 2023 10:16:02 -0400 Subject: [PATCH 24/25] CSR-1390 add .hide to hide modal on load. --- public/css/site-2020Styling.css | 3 +++ public/scss/site-2020Styling.scss | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/public/css/site-2020Styling.css b/public/css/site-2020Styling.css index 05232bd31..4aacb297d 100644 --- a/public/css/site-2020Styling.css +++ b/public/css/site-2020Styling.css @@ -73,6 +73,9 @@ opacity: 0; filter: alpha(opacity=0); } +#pageLoadingModal.hide { + display: none; +} @keyframes rotate { 0% { diff --git a/public/scss/site-2020Styling.scss b/public/scss/site-2020Styling.scss index 3f52f4b9e..4630bfdfc 100644 --- a/public/scss/site-2020Styling.scss +++ b/public/scss/site-2020Styling.scss @@ -79,6 +79,10 @@ filter: alpha(opacity=0); } } + + &.hide { + display: none; + } } @keyframes rotate { From 4723eb8098a096f2a2a04ee2b703c27371521c3d Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Sun, 29 Oct 2023 10:25:05 -0400 Subject: [PATCH 25/25] CSR-1392 associated tests --- src/helpers/heritage-integration/order-helper.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/heritage-integration/order-helper.spec.js b/src/helpers/heritage-integration/order-helper.spec.js index 322d9237d..daf9af6bb 100644 --- a/src/helpers/heritage-integration/order-helper.spec.js +++ b/src/helpers/heritage-integration/order-helper.spec.js @@ -179,7 +179,7 @@ describe("saveSession", () => { // Assert expect(mocks.baseMixin.methods.dispatchStoreActionWithLogging).toHaveBeenCalledWith( storeActions.SAVE_SESSION, - null, + { createDeleteStatusWorkOrderForPia: false, submitAfterSave: false }, "test" ); expect(mocks.baseMixin.methods.dispatchStoreAction).toHaveBeenCalledWith( @@ -282,12 +282,12 @@ describe("submitWorkOrder", () => { const mocks = setupMocksForJsFiles(mockData); // Act - await submitWorkOrder({ pageNameToLog: "test" }); + await submitWorkOrder({ pageNameToLog: "test", submitAfterSave: true }); // Assert expect(mocks.baseMixin.methods.dispatchStoreActionWithLogging).toHaveBeenCalledWith( storeActions.SAVE_SESSION, - null, + { createDeleteStatusWorkOrderForPia: false, submitAfterSave: true }, "test" ); expect(mocks.baseMixin.methods.dispatchStoreAction).toHaveBeenCalledWith( @@ -345,7 +345,7 @@ describe("submitWorkOrder", () => { setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); // Act - await submitWorkOrder({ pageNameToLog: "test" }); + await submitWorkOrder({ pageNameToLog: "test", submitAfterSave: true }); // Assert expect(cookieHelper.getFunnelCookie().DidHeritageFunnelUpdateLast).toEqual(false);