From e7e20f5f9f67e3c71c4949e43e6e6819dbd6b419 Mon Sep 17 00:00:00 2001 From: Sneha Date: Thu, 26 Sep 2024 17:34:51 +0530 Subject: [PATCH] CSR-2199 --- src/constants/analytics.js | 1 + src/layouts/quote/quote.vue | 57 ++++++++++++++++++++++++++++++++++- src/mixins/analytics-mixin.js | 7 +++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/constants/analytics.js b/src/constants/analytics.js index fe43be06d..f6534cda4 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -23,6 +23,7 @@ const GaActions = { SUBMITTED: "Submitted", DISPLAYED: "Displayed", CASH_QUOTE_DISPLAYED: "Cash quote displayed", + SERVICE_PACKAGE_PRICE: "Service package price", MOBILE_AVAILABLE: "mobile_available", SHOPS_FIRST_DISPLAYED: "shops_first_displayed", MORE_LOCATIONS_CLICKED: "more_locations_clicked", diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 62c941f90..8aedcc754 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -128,7 +128,10 @@ import { queryStrings } from "@/constants/query-strings"; import { getQuerystringParameter } from "@/helpers/querystring-helper"; import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question"; import { partTypeStrings } from "@/constants/part-type-strings"; -import { containsLineItemWithPartType } from "@/helpers/service-package-helper"; +import { + containsLineItemWithPartType, + findLineItemsWithPartType, +} from "@/helpers/service-package-helper"; import { nextTick } from "vue"; import { packageNames } from "@/constants/package-names"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; @@ -401,6 +404,18 @@ export default { this?.availableLineItems ); }, + isServicePackageDiscountOnOrder() { + return containsLineItemWithPartType( + partTypeStrings.SERVICE_PACKAGE_DISCOUNT, + this.availableLineItems + ); + }, + servicePackageDiscountParts() { + return findLineItemsWithPartType( + partTypeStrings.SERVICE_PACKAGE_DISCOUNT, + this.availableLineItems + ); + }, shouldHideRecalibration() { return ( this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() === @@ -563,6 +578,46 @@ export default { ); } }); + this.$nextTick(() => { + const availablePackageNames = this.$refs.servicePackage.servicePackageAnswers; + var eventLabel = ""; + availablePackageNames?.forEach((tier) => { + if (tier) { + let lineItemsToPrice = this.availableLineItems; + if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) { + lineItemsToPrice = lineItemsToPrice?.filter((item) => { + return item.partType != partTypeStrings.RECALIBRATION; + }); + } + if (this.isServicePackageDiscountOnOrder) { + lineItemsToPrice = lineItemsToPrice?.filter((item) => { + return ( + item.partType != this.servicePackageDiscountParts[0].partType + ); + }); + } + let price = 0; + if (tier.value == "TierTwo" && this.isServicePackageDiscountOnOrder) { + lineItemsToPrice.push(...this.servicePackageDiscountParts); + } + price += baseMixin.methods.getTierOnePackagePrice( + baseMixin.methods.filterOutFees(lineItemsToPrice) + ); + price += this.$refs.servicePackage.getVapsPrice(tier.value); + const formattedPrice = parseFloat(price).toFixed(2); + eventLabel += tier.value + "_" + formattedPrice; + } + eventLabel += ","; + }); + eventLabel = eventLabel.slice(0, -1); + + this.pushEventToGA( + "quote", + this.GaActions.SERVICE_PACKAGE_PRICE, + eventLabel, + true + ); + }); }, }, mounted() { diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index e0517080e..b66ad59dc 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -211,6 +211,13 @@ export default { payload.glassToReplace = glassString; } + //EON + if (order.eon) { + payload.eon = order.eon; + } else { + payload.eon = ""; + } + // Work Order Id if (order.workOrderId) { const parsedId = parseInt(order.workOrderId);