From 85f582e72441b6268afcadb5b99962b593fd1539 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 21 Nov 2023 17:08:30 -0500 Subject: [PATCH 01/20] CSR-1813: additional work to add 'front' or 'rear' desc to Add Vaps button label if needed --- .../add-vaps-modal-buttons.vue | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 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 cbbb51ceb..b1a96ef2a 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 @@ -62,6 +62,7 @@ import { defineRule } from "vee-validate"; import { required } from "@/helpers/validation-rules"; import { errorMessages } from "@/constants/error-messages"; import { processIfStatements } from "@/helpers/cms-content-helper"; +import { deepClone } from "@/helpers/object-helper"; // DEFINE VALIDATION RULES defineRule("checkbox-required", required(errorMessages.OPTION_REQUIRED)); @@ -198,6 +199,12 @@ export default { return null; } }, + getAnswerFromCms(name, answers) { + const answerIndex = answers.findIndex((answer) => { + return answer.Name === name; + }); + return answers[answerIndex]; + }, }, computed: { currentCartItems() { @@ -280,21 +287,17 @@ export default { } return result; }, + wipersModalDataFromCms() { + return this.getAnswerFromCms("WipersModal", this.answersCmsData); + }, + rainDefenseModalDataFromCms() { + return this.getAnswerFromCms("RainDefenseModal", this.answersCmsData); + }, buttonsToDisplay() { const buttons = []; if (!this.answersCmsData) return buttons; - const getAnswer = (name, answers) => { - const answerIndex = answers.findIndex((answer) => { - return answer.Name === name; - }); - return answers[answerIndex]; - }; - - const modalData = getAnswer("WipersModal", this.answersCmsData); - - // remove custom var for now - modalData.Text = modalData.Text?.replaceAll("{custom:WIPERTYPE}", ""); + const wipersModalData = deepClone(this.wipersModalDataFromCms); if (this.wipersOffered === wipersOfferedStrings.BOTH) { // NO REAR WIPERS or FRONT WIPERS IN CART; SHOW COMBO BUTTON @@ -303,27 +306,40 @@ export default { this.wipersModal?.totalRearPrice, ]; prices.sort((a, b) => a - b); - modalData.SubText = "+$" + prices[0] + " - $" + prices[prices.length - 1]; - buttons.push(modalData); + wipersModalData.SubText = "+$" + prices[0] + " - $" + prices[prices.length - 1]; + wipersModalData.Text = wipersModalData.Text?.replaceAll("{custom:WIPERTYPE}", ""); + buttons.push(wipersModalData); } if (this.wipersOffered === wipersOfferedStrings.FRONT) { // NO FRONT WIPERS IN CART; SHOW ONLY FRONT WIPERS BUTTON - modalData.SubText = "+$" + this.wipersModal?.totalFrontPrice; - buttons.push(modalData); + wipersModalData.SubText = "+$" + this.wipersModal?.totalFrontPrice; + if (this.rearWipersInCart) { + wipersModalData.Text = wipersModalData.Text?.replaceAll( + "{custom:WIPERTYPE}", + wipersOfferedStrings.FRONT.toLowerCase() + " " + ); + } + buttons.push(wipersModalData); } if (this.wipersOffered === wipersOfferedStrings.REAR) { // NO REAR WIPERS IN CART; SHOW ONLY REAR WIPERS BUTTON - modalData.SubText = "+$" + this.wipersModal?.totalRearPrice; - buttons.push(modalData); + wipersModalData.SubText = "+$" + this.wipersModal?.totalRearPrice; + if (this.frontWipersInCart) { + wipersModalData.Text = wipersModalData.Text?.replaceAll( + "{custom:WIPERTYPE}", + wipersOfferedStrings.REAR.toLowerCase() + " " + ); + } + buttons.push(wipersModalData); } if (!this.rainDefenseInCart) { // NO RAIN DEFENSE IN CART; SHOW RAIN DEFENSE BUTTON - const modalData = getAnswer("RainDefenseModal", this.answersCmsData); - modalData.SubText = "+$" + this.rainDefenseModal?.listPrice; - buttons.push(modalData); + const rainDefenseModalData = deepClone(this.rainDefenseModalDataFromCms); + rainDefenseModalData.SubText = "+$" + this.rainDefenseModal?.listPrice; + buttons.push(rainDefenseModalData); } return buttons; From b97238d10ac1eb75c158b142a77cfd964d453513 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 21 Nov 2023 17:12:49 -0500 Subject: [PATCH 02/20] CSR-1813: additional logic for improved button labels if only one kind is available --- .../add-vaps-modal-buttons/add-vaps-modal-buttons.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 b1a96ef2a..e637e56e6 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 @@ -319,6 +319,11 @@ export default { "{custom:WIPERTYPE}", wipersOfferedStrings.FRONT.toLowerCase() + " " ); + } else { + wipersModalData.Text = wipersModalData.Text?.replaceAll( + "{custom:WIPERTYPE}", + "" + ); } buttons.push(wipersModalData); } @@ -331,6 +336,11 @@ export default { "{custom:WIPERTYPE}", wipersOfferedStrings.REAR.toLowerCase() + " " ); + } else { + wipersModalData.Text = wipersModalData.Text?.replaceAll( + "{custom:WIPERTYPE}", + "" + ); } buttons.push(wipersModalData); } From c63665ad4c5fe183d431e463728a6f695a7a3a18 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 22 Nov 2023 08:06:18 -0500 Subject: [PATCH 03/20] CSR-1813: minor font weight fix --- .../add-vaps-modal-buttons/add-vaps-modal-buttons.vue | 2 ++ 1 file changed, 2 insertions(+) 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 e637e56e6..b8aa2dd1a 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 @@ -443,6 +443,7 @@ export default { p.price { text-align: center; color: $green; + font-weight: 500; } p:last-child { margin-bottom: 0; @@ -464,6 +465,7 @@ export default { .additional-button-data { font-size: 0.875rem; + font-weight: 500; line-height: 1.75; padding-left: 0.5rem; color: $green; From da9c77e3035e033f24713d73ddc2b486cb4a7ea7 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Wed, 22 Nov 2023 20:10:24 +0530 Subject: [PATCH 04/20] CSR-1663 changing the component to enforce a max of 150 characters. --- src/digital-components/textarea-question/textarea-question.vue | 2 +- src/layouts/customer-details/customer-details.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/digital-components/textarea-question/textarea-question.vue b/src/digital-components/textarea-question/textarea-question.vue index aa81c8286..eeede3a63 100644 --- a/src/digital-components/textarea-question/textarea-question.vue +++ b/src/digital-components/textarea-question/textarea-question.vue @@ -35,7 +35,7 @@ export default { isRequired: Boolean, maxLength: { type: Number, - default: 250, + default: 150, }, modelValue: String, }, diff --git a/src/layouts/customer-details/customer-details.vue b/src/layouts/customer-details/customer-details.vue index 668bd0495..08d547f96 100644 --- a/src/layouts/customer-details/customer-details.vue +++ b/src/layouts/customer-details/customer-details.vue @@ -48,7 +48,7 @@ class="mb-4" v-model="techNotes" cmsWidgetName="TextAreaContentWidget" - maxLength="250" /> + maxLength="150" /> From ff703cdc662f7768a5a46f83b4423ebf1386f4cd Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Wed, 22 Nov 2023 10:41:58 -0500 Subject: [PATCH 05/20] CSR-1732 fix character count text color. --- src/digital-components/textarea-question/textarea-question.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/digital-components/textarea-question/textarea-question.vue b/src/digital-components/textarea-question/textarea-question.vue index eeede3a63..eda3a6f9c 100644 --- a/src/digital-components/textarea-question/textarea-question.vue +++ b/src/digital-components/textarea-question/textarea-question.vue @@ -103,7 +103,7 @@ export default { } } p { - color: $gray-500; + color: $gray-600; &.urgent-countdown { color: $red; } From af512667f02bddcefe4327a857e0202bc549cf57 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 23 Nov 2023 12:01:27 +0530 Subject: [PATCH 06/20] error message --- .../promo-modal-question.vue | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index cde033066..3f7e4368a 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -26,7 +26,14 @@ class="my-4 alert" cmsWidgetName="AlertInvalidPromoWidget" alertClass="alert-danger" - v-bind:isDismissible="true" /> + v-bind:isDismissible="false" /> + + v-bind:isDismissible="false" />
Promo code "{{ promoCode }}" applied Date: Thu, 23 Nov 2023 19:18:15 +0530 Subject: [PATCH 07/20] Update payment.vue newValidatedPromos contains both validated and revalidated promos so can replace the existing promos in the lineitems. --- src/layouts/payment/payment.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment/payment.vue b/src/layouts/payment/payment.vue index 95f427b8f..d86859668 100644 --- a/src/layouts/payment/payment.vue +++ b/src/layouts/payment/payment.vue @@ -350,8 +350,8 @@ export default { const taxedVaps = mapTaxedLineItemsToStoreFormat(taxedLineItems, availableVaps); // Add items that were not in the store yet but added via query string promo validation - lineItems.promos = lineItems.promos ?? []; - lineItems.promos.push(...newValidatedPromos); + //newValidatedPromos contains both validated and revalidated promos. + lineItems.promos = Array.from(newValidatedPromos); const vapsToAddToCart = getVapsThatNeedToBeAddedToSatisfyPromos( newValidatedPromos, taxedVaps, From 1945bb02d98de6453d1f62127e10020110c359cd Mon Sep 17 00:00:00 2001 From: Sneha Date: Fri, 24 Nov 2023 11:35:44 +0530 Subject: [PATCH 08/20] CSR-1827 --- .../promo-modal-question.spec.js | 4 +- .../promo-modal-question.vue | 85 ++++++++++++++----- 2 files changed, 66 insertions(+), 23 deletions(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js b/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js index 94de72765..110ece01e 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js @@ -49,7 +49,9 @@ describe("promo-modal-question.vue", () => { // Assert expect(wrapper.vm.displayInvalidPromoAlert).toBe(false); - expect(wrapper.vm.displayInvalidOnOrderPromoAlert).toBe(false); + expect(wrapper.vm.displayStackingPromoAlert).toBe(false); + expect(wrapper.vm.displayInShopPromoAlert).toBe(false); + expect(wrapper.vm.displaySimilarPromoAlert).toBe(false); }); it("Should emit update:modelValue on Modal closed", async () => { // Arrange diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index 3f7e4368a..bf0359b37 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -22,7 +22,7 @@ +
@@ -78,9 +86,11 @@ export default { return { promoCode: "", promoTextInputId: "", + errorMessage: "", displayInvalidPromoAlert: false, displaySimilarPromoAlert: false, - displayInvalidOnOrderPromoAlert: false, + displayStackingPromoAlert: false, + displayInShopPromoAlert: false, lineItems: deepClone(this.modelValue), }; }, @@ -105,20 +115,14 @@ export default { modal() { return this.$refs[this.modalName]; }, - PromoOnOrderText() { - return this.getCmsContent("AlertInvalidPromoOnOrderWidget", "HeadlineText"); - }, - InvalidPromoOnOrderText() { - return this.PromoOnOrderText?.replaceAll( - "{custom:NEWPROMOCODE}", - this.promoCode.toUpperCase() - ).replaceAll("{custom:OLDPROMOCODE}", this.getPromoCode()?.toUpperCase()); + StackPromoText() { + return this.getCmsContent("AlertStackingPromoWidget", "HeadlineText"); }, PromoText() { return this.getCmsContent("AlertInvalidPromoWidget", "HeadlineText"); }, - InvalidPromoText() { - return this.PromoText?.replaceAll("{custom:PROMOCODE}", this.promoCode.toUpperCase()); + InShopPromoText() { + return this.getCmsContent("AlertInshopPromoWidget", "HeadlineText"); }, removeLinkText() { return this.getCmsContent("RemoveCartItemTextWidget", "Text"); @@ -126,8 +130,11 @@ export default { }, methods: { resetAlerts() { - this.displayInvalidOnOrderPromoAlert = false; + this.displayStackingPromoAlert = false; this.displayInvalidPromoAlert = false; + this.displaySimilarPromoAlert = false; + this.displayInShopPromoAlert = false; + this.errorMessage = ""; }, resetsOnPromoInput() { this.resetAlerts(); @@ -138,8 +145,16 @@ export default { ); return promosToDisplay; }, - getPromoCode() { - return this.lineItems.promos?.[0]?.promoCode; + getConflictingPromoCode(additionalInfo) { + var conflictingCodes = additionalInfo?.[0]; + if (additionalInfo?.length > 1) { + if (additionalInfo?.length > 2) conflictingCodes += ","; + for (let i = 1; i < additionalInfo?.length - 1; i++) { + conflictingCodes += ` "${additionalInfo[i]}",`; + } + conflictingCodes += ` and "${additionalInfo?.slice(-1)[0]}"`; + } + return conflictingCodes; }, onInputIdAssigned(inputId) { this.promoTextInputId = inputId; @@ -194,10 +209,35 @@ export default { switch (error) { case promoErrorCodes.PROMO_STACKING_NOT_ALLOWED: case promoErrorCodes.SIMILAR_PROMO_ALREADY_ON_ORDER: - if (additionalInfo[0] === this.promoCode.toUpperCase()) + if ( + additionalInfo.length === 1 && + additionalInfo[0] === this.promoCode.toUpperCase() + ) { return (this.displaySimilarPromoAlert = true); - return (this.displayInvalidOnOrderPromoAlert = true); + } else { + this.errorMessage = this.StackPromoText?.replaceAll( + "{custom:NEWPROMOCODE}", + this.promoCode.toUpperCase() + ).replaceAll( + "{custom:OLDPROMOCODE}", + this.getConflictingPromoCode(additionalInfo) + ); + return (this.displayStackingPromoAlert = true); + } + case promoErrorCodes.INVALID_PROMO_ON_ORDER: + if (additionalInfo.some((x) => x.toUpperCase() === "APPOINTMENT_TYPE")) { + this.errorMessage = this.InShopPromoText?.replaceAll( + "{custom:INSHOPPROMOCODE}", + this.promoCode.toUpperCase() + ); + return (this.displayInShopPromoAlert = true); + } + break; default: + this.errorMessage = this.PromoText?.replaceAll( + "{custom:PROMOCODE}", + this.promoCode.toUpperCase() + ); return (this.displayInvalidPromoAlert = true); } }, @@ -257,8 +297,9 @@ export default { watch: { promoCode() { this.displayInvalidPromoAlert = false; - this.displayInvalidOnOrderPromoAlert = false; + this.displayStackingPromoAlert = false; this.displaySimilarPromoAlert = false; + this.displayInShopPromoAlert = false; }, modelValue: { handler(newValue) { From 860eed41517930c3be9dc75e5f4fde6da9b24c98 Mon Sep 17 00:00:00 2001 From: Sneha Date: Fri, 24 Nov 2023 14:44:01 +0530 Subject: [PATCH 09/20] Update promo-modal-question.vue --- .../promo-modal-question.vue | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index bf0359b37..8cc561b03 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -209,21 +209,17 @@ export default { switch (error) { case promoErrorCodes.PROMO_STACKING_NOT_ALLOWED: case promoErrorCodes.SIMILAR_PROMO_ALREADY_ON_ORDER: - if ( - additionalInfo.length === 1 && + return additionalInfo.length === 1 && additionalInfo[0] === this.promoCode.toUpperCase() - ) { - return (this.displaySimilarPromoAlert = true); - } else { - this.errorMessage = this.StackPromoText?.replaceAll( - "{custom:NEWPROMOCODE}", - this.promoCode.toUpperCase() - ).replaceAll( - "{custom:OLDPROMOCODE}", - this.getConflictingPromoCode(additionalInfo) - ); - return (this.displayStackingPromoAlert = true); - } + ? (this.displaySimilarPromoAlert = true) + : ((this.errorMessage = this.StackPromoText?.replace( + /\{custom:(NEW|OLD)PROMOCODE\}/g, + (match, group) => + group === "NEW" + ? this.promoCode.toUpperCase() + : this.getConflictingPromoCode(additionalInfo) + )), + (this.displayStackingPromoAlert = true)); case promoErrorCodes.INVALID_PROMO_ON_ORDER: if (additionalInfo.some((x) => x.toUpperCase() === "APPOINTMENT_TYPE")) { this.errorMessage = this.InShopPromoText?.replaceAll( From 0d1c72c357f068f7357002f64502e8f002e25863 Mon Sep 17 00:00:00 2001 From: Sneha Date: Fri, 24 Nov 2023 17:00:41 +0530 Subject: [PATCH 10/20] formatting --- .../promo-modal-question/promo-modal-question.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index 8cc561b03..04d2162da 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -150,9 +150,9 @@ export default { if (additionalInfo?.length > 1) { if (additionalInfo?.length > 2) conflictingCodes += ","; for (let i = 1; i < additionalInfo?.length - 1; i++) { - conflictingCodes += ` "${additionalInfo[i]}",`; + conflictingCodes += ` "${additionalInfo[i]},`; } - conflictingCodes += ` and "${additionalInfo?.slice(-1)[0]}"`; + conflictingCodes += `" and "${additionalInfo?.slice(-1)[0]}`; } return conflictingCodes; }, From 38dc3be0420cb456a8467269f5595c7259943ae8 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Fri, 24 Nov 2023 09:44:26 -0500 Subject: [PATCH 11/20] CSR-1820 | Promo Price fix on Quote Page --- src/layouts/quote/quote.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 1357e5acc..a07f73566 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -299,6 +299,9 @@ export default { { activePromos: this.allActivePromos }, false ); + // Clear out local promos to avoid duplicates in `allActivePromos` computed + // otherwise package price changes while next page is loading + this.newValidatedPromos = []; const payment = this.$store.getters.payment; if (payment.isInsurance) { From 8287c5dc119bb8a5dca400f70f747919bb82be12 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Mon, 27 Nov 2023 14:59:01 +0530 Subject: [PATCH 12/20] Reset form on modal closed Reset form on modal closed --- .../promo-modal-question/promo-modal-question.spec.js | 1 + .../payment-method/promo-modal-question/promo-modal-question.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js b/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js index 110ece01e..16d170e82 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.spec.js @@ -11,6 +11,7 @@ jest.mock("@/digital-components/modal/modal", () => ({ methods: { closeModal: jest.fn(), resetButtonStyle: jest.fn(), + resetForm: jest.fn(), }, })); diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index 04d2162da..120e88292 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -169,6 +169,7 @@ export default { this.resetAlerts(); this.$emit("update:modelValue", this.lineItems); this.promoCode = ""; + this.modal.resetForm(); }, focusOnPromoInput() { const input = document.getElementById(this.promoTextInputId); From e2d39f6b822f6cd4d507d198d31f04154e635964 Mon Sep 17 00:00:00 2001 From: Sneha Date: Mon, 27 Nov 2023 17:16:21 +0530 Subject: [PATCH 13/20] Invalid error message --- .../promo-modal-question/promo-modal-question.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index 120e88292..b8ee8ad87 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -229,7 +229,13 @@ export default { ); return (this.displayInShopPromoAlert = true); } - break; + else{ + this.errorMessage = this.PromoText?.replaceAll( + "{custom:PROMOCODE}", + this.promoCode.toUpperCase() + ); + return (this.displayInvalidPromoAlert = true); + } default: this.errorMessage = this.PromoText?.replaceAll( "{custom:PROMOCODE}", From bfc26af1b10c411f6fc6740f32f991822ac5c5f1 Mon Sep 17 00:00:00 2001 From: Sneha Date: Mon, 27 Nov 2023 17:19:37 +0530 Subject: [PATCH 14/20] Update promo-modal-question.vue --- .../promo-modal-question/promo-modal-question.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue index b8ee8ad87..7c3a95151 100644 --- a/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue +++ b/src/layouts/payment-method/promo-modal-question/promo-modal-question.vue @@ -228,13 +228,12 @@ export default { this.promoCode.toUpperCase() ); return (this.displayInShopPromoAlert = true); - } - else{ + } else { this.errorMessage = this.PromoText?.replaceAll( - "{custom:PROMOCODE}", - this.promoCode.toUpperCase() - ); - return (this.displayInvalidPromoAlert = true); + "{custom:PROMOCODE}", + this.promoCode.toUpperCase() + ); + return (this.displayInvalidPromoAlert = true); } default: this.errorMessage = this.PromoText?.replaceAll( From 506308fb3e151794c423dbd07317ef2ade433576 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 27 Nov 2023 09:56:44 -0500 Subject: [PATCH 15/20] CSR-1840 fix button width when two buttons. --- src/layouts/vehicle-parts/vehicle-parts.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 3455de18e..ea33f7642 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -249,5 +249,8 @@ export default { height: auto; } } + .two-list-card-width { + width: 100%; + } } From 4b87384e55d13e1714a570227de3c43e564fd142 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 28 Nov 2023 10:09:49 -0500 Subject: [PATCH 16/20] CSR-1841 | Change query string promo logic for save quote email purposes --- src/helpers/promotions-helper.js | 15 +++++++++++++-- src/layouts/quote/quote.vue | 16 +--------------- src/store/index.js | 2 ++ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/helpers/promotions-helper.js b/src/helpers/promotions-helper.js index 567304de6..f37a78e71 100644 --- a/src/helpers/promotions-helper.js +++ b/src/helpers/promotions-helper.js @@ -132,8 +132,19 @@ export async function revalidatePromosAndValidateQueryStringPromo( pageNameToLog, false ); - if (!excludeFromInactivePromoErrorCodes.includes(validatePromoResponse.errorCode)) { - // Save any valid (applied or not) query string promoCode to inactivePromos + if (validatePromoResponse.errorCode == null) { + // Save promo to store + const activePromos = store.getters.order.lineItems.promos ?? []; + activePromos.push(...validatePromoResponse.orderPromos); + baseMixin.methods.dispatchStoreAction( + storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, + { + activePromos: activePromos, + }, + false + ); + } else if (!excludeFromInactivePromoErrorCodes.includes(validatePromoResponse.errorCode)) { + // Save any valid query string promoCode (not applied) to inactivePromos // in order to not lose the query string promoCode if back button is pressed const inactivePromoCodes = store.getters.payment.inactivePromos ?? []; if (!inactivePromoCodes.includes(newPromo)) { diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index a07f73566..e48e8fff8 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -178,7 +178,6 @@ export default { vm.supportingItems = resultMap.supportingItems; vm.availableLineItems = pricingResults; vm.isInsuranceSelected = vm.getDefaultIsInsuranceSelectedValue(vm.availableLineItems); - vm.newValidatedPromos = validatePromoResponse?.orderPromos; if (revalidatePromoResponse) { const revalidateAlerts = buildToastMessagesFromRevalidateOrValidatePromoResponse( @@ -207,16 +206,11 @@ export default { availableLineItems: null, supportingItems: null, pricedGlassParts: null, - newValidatedPromos: null, }; }, computed: { allActivePromos() { - const allActivePromos = []; - if (this.newValidatedPromos) allActivePromos.push(...this.newValidatedPromos); - if (this.$store.getters.order.lineItems.promos) - allActivePromos.push(...this.$store.getters.order.lineItems.promos); - return allActivePromos; + return this.$store.getters.order.lineItems.promos ?? []; }, }, methods: { @@ -294,14 +288,6 @@ export default { } this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false); - this.dispatchStoreAction( - this.storeActions.SAVE_ACTIVE_AND_OR_INACTIVE_PROMOS, - { activePromos: this.allActivePromos }, - false - ); - // Clear out local promos to avoid duplicates in `allActivePromos` computed - // otherwise package price changes while next page is loading - this.newValidatedPromos = []; const payment = this.$store.getters.payment; if (payment.isInsurance) { diff --git a/src/store/index.js b/src/store/index.js index 332b60cf6..efaf5b428 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2130,6 +2130,8 @@ export const actions = { }, // Manage promo saving to ensure a promoCode never ends up in both active and inactive saveActiveAndOrInactivePromos(context, { activePromos = null, inactivePromos = null }) { + activePromos = activePromos?.slice(0); + inactivePromos = inactivePromos?.slice(0); let activePromosToSave; let inactivePromosToSave; if (!activePromos && !inactivePromos) { From 0a9466af9f9ae00b6c8f7739925545ad1cdc9578 Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Tue, 28 Nov 2023 12:10:43 -0500 Subject: [PATCH 17/20] Pass error status by querystring --- src/constants/query-strings.js | 1 + src/layouts/payment-method/payment-method.vue | 8 ++++++-- src/layouts/payment-pia-return/payment-pia-return.vue | 9 +++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/constants/query-strings.js b/src/constants/query-strings.js index 40f3a2242..5c056c934 100644 --- a/src/constants/query-strings.js +++ b/src/constants/query-strings.js @@ -19,6 +19,7 @@ const queryStrings = { AUTH_CODE: "auth_code", TRANSACTION_ID: "transaction_id", TRANS_REFERENCE_NUMBER: "auth_trans_ref_no", + DISPLAY_PIA_ALERT: "displayPiaAlert", }; export { queryStrings }; diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index 6fa1b02a6..e13f62590 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -103,6 +103,7 @@ import { getNewlyInactivatedPromos, } from "@/helpers/promotions-helper"; import { queryStrings } from "@/constants/query-strings"; +import { routerParams } from "@/router/router-constants/router-params"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import { deepClone } from "@/helpers/object-helper"; @@ -421,7 +422,7 @@ export default { } 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; + this.$route.params[routerParams.DISPLAY_PIA_ALERT] = true; return; } } @@ -469,7 +470,10 @@ export default { return this.paymentMethodInternalModel; }, shouldDisplayPiaAlert() { - return this.$route.params[this.routerParams.DISPLAY_PIA_ALERT]; + return ( + this.$route.query[queryStrings.DISPLAY_PIA_ALERT] || + this.$route.params[routerParams.DISPLAY_PIA_ALERT] + ); }, // Necessary to make the watcher of lineItems work // JavaScript does not keep a record of the old value, only a reference to it's location in the memory. diff --git a/src/layouts/payment-pia-return/payment-pia-return.vue b/src/layouts/payment-pia-return/payment-pia-return.vue index 8088cbb06..d12e45705 100644 --- a/src/layouts/payment-pia-return/payment-pia-return.vue +++ b/src/layouts/payment-pia-return/payment-pia-return.vue @@ -24,12 +24,9 @@ export default { if (piaError) { console.log("Error during payment: " + piaError); - this.$router.navigateWithoutSaving( - this.navigationScenarios.PIA_ERROR, - this.$route, - {}, - { [routerParams.DISPLAY_PIA_ALERT]: true } - ); + this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_ERROR, this.$route, { + [queryStrings.DISPLAY_PIA_ALERT]: true, + }); } else { switch (store.getters.order.payment.piaType) { case paymentMethods.CREDIT_CARD: From a0262ed974b20901a2556bea49dcedfd9226d16d Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 28 Nov 2023 15:04:54 -0500 Subject: [PATCH 18/20] CSR-1819 add screenreader text to improve accessibility. --- src/fmg-components/cart/cart.vue | 39 +++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index c1a9608a8..242d37c11 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -5,7 +5,7 @@ class="row vin-toggle flex align-items-center pt-4" :class="[isExpanded ? 'expanded' : '']" @click="toggleIsExpanded()"> - + {{ amountDueText }} {{ getFormattedAmount("", amountDue) }} @@ -13,7 +13,8 @@
- + + {{screenReaderTotalAmountDueText}} {{ getFormattedAmount("", packagePrice) }}
@@ -27,7 +28,11 @@ linkType="text" :text="removeLinkText" href="#!" - @click-event="removeItem(cartItem.cartItemType, cartItem.category)" /> + @click-event="removeItem(cartItem.cartItemType, cartItem.category)"> + +
@@ -56,25 +61,25 @@ {{ recycleFeeCartItem.name }} - {{ getFormattedAmount(cartItem.category, cartItem.subTotal) }} + {{screenReaderRecycleFeeText}}{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}
{{ subtotalText }}{{ getFormattedAmount("", subTotal) }} + >{{screenReaderSubTotalText}}{{ getFormattedAmount("", subTotal) }}
{{ salesTaxText }}{{ getFormattedAmount("", salesTax) }} + >{{screenReaderSalesTaxText}}{{ getFormattedAmount("", salesTax) }}
{{ amountPaidText }}{{ getFormattedAmount("", amountPaid) }} + >{{screenReaderAmountPaidText}}{{ getFormattedAmount("", amountPaid) }}
{{ amountDueText }}{{ getFormattedAmount("", amountDue) }} + >{{screenReaderTotalAmountDueText}}{{ getFormattedAmount("", amountDue) }}
@@ -187,6 +192,24 @@ export default { }, }, computed: { + screenReaderTotalAmountDueText() { + return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text"); + }, + screenReaderRemoveVapsText() { + return this.getCmsContent("ScreenReaderRemoveVapsWidget", "Text"); + }, + screenReaderRecycleFeeText() { + return this.getCmsContent("ScreenReaderRecycleFeeWidget", "Text"); + }, + screenReaderSubTotalText() { + return this.getCmsContent("ScreenReaderSubTotalWidget", "Text"); + }, + screenReaderAmountPaidText() { + return this.getCmsContent("ScreenReaderAmountPaidWidget", "Text"); + }, + screenReaderSalesTaxText() { + return this.getCmsContent("ScreenReaderSalesTaxWidget", "Text"); + }, availableLineItems() { if (!this.lineItems || this.lineItems.length < 1) { return []; From c48951cb868632a5d3be630e9ef3bdcff5765081 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 28 Nov 2023 15:06:47 -0500 Subject: [PATCH 19/20] Format code. --- src/fmg-components/cart/cart.vue | 44 ++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/fmg-components/cart/cart.vue b/src/fmg-components/cart/cart.vue index 242d37c11..1180b3152 100644 --- a/src/fmg-components/cart/cart.vue +++ b/src/fmg-components/cart/cart.vue @@ -5,7 +5,10 @@ class="row vin-toggle flex align-items-center pt-4" :class="[isExpanded ? 'expanded' : '']" @click="toggleIsExpanded()"> - + {{ amountDueText }} {{ getFormattedAmount("", amountDue) }} @@ -14,7 +17,7 @@
- {{screenReaderTotalAmountDueText}} + {{ screenReaderTotalAmountDueText }} {{ getFormattedAmount("", packagePrice) }}
@@ -61,25 +64,40 @@ {{ recycleFeeCartItem.name }} - {{screenReaderRecycleFeeText}}{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }} + {{ screenReaderRecycleFeeText }}{{ getFormattedAmount(cartItem.category, cartItem.subTotal) }}
{{ subtotalText }}{{screenReaderSubTotalText}}{{ getFormattedAmount("", subTotal) }} + >{{ screenReaderSubTotalText }}{{ getFormattedAmount("", subTotal) }}
{{ salesTaxText }}{{screenReaderSalesTaxText}}{{ getFormattedAmount("", salesTax) }} + >{{ screenReaderSalesTaxText }}{{ getFormattedAmount("", salesTax) }}
{{ amountPaidText }}{{screenReaderAmountPaidText}}{{ getFormattedAmount("", amountPaid) }} + >{{ screenReaderAmountPaidText }}{{ getFormattedAmount("", amountPaid) }}
{{ amountDueText }}{{screenReaderTotalAmountDueText}}{{ getFormattedAmount("", amountDue) }} + >{{ screenReaderTotalAmountDueText }}{{ getFormattedAmount("", amountDue) }}
@@ -193,22 +211,22 @@ export default { }, computed: { screenReaderTotalAmountDueText() { - return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text"); + return this.getCmsContent("ScreenReaderTotalAmountDueWidget", "Text"); }, screenReaderRemoveVapsText() { - return this.getCmsContent("ScreenReaderRemoveVapsWidget", "Text"); + return this.getCmsContent("ScreenReaderRemoveVapsWidget", "Text"); }, screenReaderRecycleFeeText() { - return this.getCmsContent("ScreenReaderRecycleFeeWidget", "Text"); + return this.getCmsContent("ScreenReaderRecycleFeeWidget", "Text"); }, screenReaderSubTotalText() { - return this.getCmsContent("ScreenReaderSubTotalWidget", "Text"); + return this.getCmsContent("ScreenReaderSubTotalWidget", "Text"); }, screenReaderAmountPaidText() { - return this.getCmsContent("ScreenReaderAmountPaidWidget", "Text"); + return this.getCmsContent("ScreenReaderAmountPaidWidget", "Text"); }, screenReaderSalesTaxText() { - return this.getCmsContent("ScreenReaderSalesTaxWidget", "Text"); + return this.getCmsContent("ScreenReaderSalesTaxWidget", "Text"); }, availableLineItems() { if (!this.lineItems || this.lineItems.length < 1) { From f165bd41b9beb6e0211407160c8ed969b57923c0 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 28 Nov 2023 15:10:28 -0500 Subject: [PATCH 20/20] CSR-1845 | Fix quote pricing with bundle promos --- src/helpers/promotions-helper.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/helpers/promotions-helper.js b/src/helpers/promotions-helper.js index f37a78e71..3968248d6 100644 --- a/src/helpers/promotions-helper.js +++ b/src/helpers/promotions-helper.js @@ -213,16 +213,33 @@ export function buildToastMessagesFromRevalidateOrValidatePromoResponse( } export function getPromosThatMatchLineItemsOnOrder(promos, lineItemsOnOrder) { + const matchingPromoCodes = []; const matchingPromos = []; + const consolidatedPromosWithIds = {}; + // Combine bundle promos to make sure each part of the bundle is satisfied promos.forEach((promo) => { + const cleanPromoCode = getPromoCodeWithoutBundleIdentifier(promo.promoCode); + if (consolidatedPromosWithIds[cleanPromoCode]) { + consolidatedPromosWithIds[cleanPromoCode].push(...promo.discountedLineItemIds); + } else { + consolidatedPromosWithIds[cleanPromoCode] = promo.discountedLineItemIds.slice(0); + } + }); + Object.keys(consolidatedPromosWithIds).forEach((promoCode) => { let allIdsMatch = true; - promo.discountedLineItemIds.forEach((id) => { + consolidatedPromosWithIds[promoCode].forEach((id) => { if (lineItemsOnOrder.filter((x) => x.id === id).length === 0) { allIdsMatch = false; return; } }); if (allIdsMatch) { + matchingPromoCodes.push(promoCode); + } + }); + promos.forEach((promo) => { + const cleanPromoCode = getPromoCodeWithoutBundleIdentifier(promo.promoCode); + if (matchingPromoCodes.includes(cleanPromoCode)) { matchingPromos.push(promo); } });