Merge pull request #2407 from Safelite/feature/bug-fix/CASH-484

CASH-484: adding fix to remove any PBD lineItems before loading insurance-company page
This commit is contained in:
AdamCaouetteSafelite 2025-04-09 08:09:30 -04:00 committed by GitHub
commit ad109221a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,11 +53,33 @@ import { Form, defineRule } from "vee-validate";
import baseMixin from "@/mixins/base-mixin.js";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import { applicationConfig } from "@/constants/application-config";
import experimentMixin from "@/mixins/experiment-mixin.js";
import { experimentSettings } from "@/constants/experiments";
import { partNumberStrings } from "@/constants/part-number-strings";
import { deepClone } from "@/helpers/object-helper";
import store from "@/store";
export default {
name: "insurance-company",
async beforeRouteEnter(to, from, next) {
// Remove any Pricing By Day lineItems before going to Heritage insurance
const isPricingByDayExperiment = experimentMixin.methods.hasSettingEqualTo(
experimentSettings.PRICING_BY_DAY,
"true"
);
if (isPricingByDayExperiment) {
const lineItems = deepClone(store.getters.order.lineItems);
const supportingItemsWithoutPricingByDay =
baseMixin.methods.filterOutCertainPartTypesOrNumbers(lineItems.supportingItems, {
partNumbersToRemove: [partNumberStrings.PRICING_BY_DAY_UPCHARGE],
});
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING,
supportingItemsWithoutPricingByDay,
false
);
}
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const insuranceCompanyListPromise = baseMixin.methods.dispatchStoreActionWithLogging(