diff --git a/src/helpers/cart-helper.js b/src/helpers/cart-helper.js index 405dea57..1920df3c 100644 --- a/src/helpers/cart-helper.js +++ b/src/helpers/cart-helper.js @@ -28,6 +28,20 @@ export function getServiceLineItems(order) { ]; } +/** + * Returns an array containing only the + * @param {object} order order object + * @returns {[]} array of service line items + */ +export function getAvailableLineItems(order) { + const { glassParts, supportingItems } = getLineItems(order); + const availableLineItems = [ + ...(glassParts ?? []), + ...(supportingItems ?? []) + ]; + return availableLineItems; +} + /** * Returns an array containing only the non-service line items (Vaps and Fees) * @param {object} order order object diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue index 54e341ff..b918ce71 100644 --- a/src/layouts/coverage-statement/coverage-statement.vue +++ b/src/layouts/coverage-statement/coverage-statement.vue @@ -145,6 +145,7 @@ import widgetFields from '@/constants/cms-widget-fields.js'; import { formatAmountInDollars, createUnorderedListFromStringOfParagraphs, createOrderedListFromStringOfParagraphs } from '@/helpers/text-helper.js'; import showIssLoadingModal from '@/helpers/loading-modal-helper'; import { getPriceOfLineItems } from '@/helpers/price-calculator'; +import { getAvailableLineItems } from '@/helpers/cart-helper'; import coverageStatuses from '@/constants/coverage-statuses'; import coverageType from '@/constants/coverage-type'; import oemEndorsementModal from '@/layouts/coverage-statement/oem-endorsement-modal/oem-endorsement-modal.vue'; @@ -494,6 +495,7 @@ export default { this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD); } else if (this.isITACQuoteVisible || this.isNoCompQuoteVisible) { this.mainStore.updateIsSafeliteProvider(true); + this.pushEventToGA('ShopSelection', 'Safelite', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true); this.navigateWithScenario(navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE); } else { this.$router.navigateBailout(bailoutMessage.coverageStatementInvalidState()); diff --git a/src/layouts/provider-preference/provider-preference.vue b/src/layouts/provider-preference/provider-preference.vue index ff2fdf5c..27f88d72 100644 --- a/src/layouts/provider-preference/provider-preference.vue +++ b/src/layouts/provider-preference/provider-preference.vue @@ -67,6 +67,8 @@ import showIssLoadingModal from '@/helpers/loading-modal-helper'; import bailoutMessage from '@/constants/bailoutMessage'; import baseFormMixin from '@/mixins/base-form-mixin'; import PROVIDER_PREFERENCE_OPTIONS from '@/constants/provider-preference'; +import { getPriceOfLineItems } from '@/helpers/price-calculator'; +import { getAvailableLineItems } from '@/helpers/cart-helper'; // Import Component import { Form } from 'vee-validate'; @@ -159,12 +161,14 @@ export default { this.mainStore.updateIsSafeliteProvider(true); const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE; this.pushEventToGA('prefered_provider', 'Safelite', this.mainStore.accountNameForEvents, true); + this.pushEventToGA('ShopSelection', 'Safelite', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true); this.navigateForward(scenario); }, scheduleWithTPA() { this.mainStore.updateIsSafeliteProvider(false); const scenario = this.navigationScenarios.CLICKED_FORWARD_WITH_TPA_ENABLED; this.pushEventToGA('prefered_provider', 'TPA', this.mainStore.accountNameForEvents, true); + this.pushEventToGA('ShopSelection', 'Other', this.mainStore.currentDeductible + `_` + getPriceOfLineItems(getAvailableLineItems(this.mainStore.order)), true); this.navigateForward(scenario); }, findAnotherShopClicked() { diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 9b30181b..6480a508 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -20,7 +20,8 @@ import { GaEvents, ValueToLogTypes } from '@/constants/analytics'; -import { getCartTotal, getSubtotal } from '@/helpers/cart-helper'; +import { getPriceOfLineItems } from '@/helpers/price-calculator'; +import { getAvailableLineItems, getCartTotal, getSubtotal } from '@/helpers/cart-helper'; import { getRecalPartNumbers, isRecalOrder } from "@/helpers/recal-helper"; import coverageStatuses from '@/constants/coverage-statuses'; import coverageType from '@/constants/coverage-type'; @@ -273,7 +274,7 @@ export default { payload.priceTotal = ""; // ITAC or NoComp (where cash price is shown) } else if (store.isVerified && (store.isITAC || store.isNoComp)) { - const subtotal = getSubtotal(order).toFixed(2); + const subtotal = getPriceOfLineItems(getAvailableLineItems(order)).toFixed(2); payload.priceSubTotal = parseFloat(subtotal); const total = getCartTotal(order).toFixed(2); payload.priceTotal = parseFloat(total); @@ -283,7 +284,7 @@ export default { } // Cash Quote or Cash Price Sub Total - payload.cashPriceSubTotal = getSubtotal(order).toString(); + payload.cashPriceSubTotal = getPriceOfLineItems(getAvailableLineItems(order)).toString(); // Recalibration payload.isRecalibrationOnOrder = isRecalOrder(order.lineItems);