Updates to some event pricing output and adding ShopSelection event.

This commit is contained in:
Jeremy-Z 2026-04-21 15:24:49 -04:00
parent 0a040371eb
commit 828167813c
4 changed files with 24 additions and 3 deletions

View file

@ -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

View file

@ -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());

View file

@ -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() {

View file

@ -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);