CASH-484: adding fix to remove any PBD lineItems before loading insurance-company page

This commit is contained in:
Adam Caouette 2025-04-08 22:05:50 -04:00
parent f71de530af
commit 7571e74197

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(