Merge branch 'release/2024.11.21' into feature/routerLogs

This commit is contained in:
CarlNation 2024-11-15 11:53:11 -05:00
commit 06c52b12ba
7 changed files with 45 additions and 148 deletions

View file

@ -1,6 +1,6 @@
<template>
<div class="cart">
<div class="px-0">
<div class="px-0" v-if="isCartReadyToLoad">
<div
class="row vin-toggle flex align-items-center pt-4"
:class="[isExpanded ? 'expanded' : '']"
@ -196,7 +196,7 @@ export default {
},
data() {
return {
isExpanded: this.shouldHideRecalibration,
isExpanded: false,
currencyFormatter: new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
@ -210,6 +210,9 @@ export default {
toggleIsExpanded() {
this.isExpanded = !this.isExpanded;
},
updateIsExpandedWithDefault() {
this.isExpanded = this.shouldHideRecalibration;
},
getVapsPrice(packageName) {
const vapsItems = this.getVapsCartItemsForSelectedPackage(packageName);
@ -313,6 +316,11 @@ export default {
},
},
computed: {
isCartReadyToLoad() {
var myReturn = this.shouldHideRecalibration !== null;
this.updateIsExpandedWithDefault();
return myReturn;
},
lineItems: {
get: function () {
return this.modelValue;

View file

@ -559,140 +559,6 @@ describe("computed properties...", () => {
// Assert
expect(testValue).toEqual("Duration: Overnight");
});
test("NoComp should return false for shouldHideRecalibration", () => {
//Arrange
const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
policy: {
isNoComp: true,
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
// Act
const testValue = wrapper.vm.shouldHideRecalibration;
// Assert
expect(testValue).toEqual(false);
});
test("Itac should return false for shouldHideRecalibration", () => {
//Arrange
const { wrapper } = setupMocks({});
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
policy: {
isItac: true,
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.vm.submittedOrder.serviceLocation.appointmentType = AppointmentTypeStrings.MOBILE;
// Act
const testValue = wrapper.vm.shouldHideRecalibration;
// Assert
expect(testValue).toEqual(false);
});
test("Not Itac/NoComp with Recal should return true for shouldHideRecalibration", async () => {
//Arrange
const { wrapper } = setupMocks({});
const lineItems = {
glassParts: [
{
partType: "RECALIBRATION",
},
],
};
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
policy: {
isItac: false,
isNoComp: false,
},
lineItems: {
glassParts: {
partType: "Recalibration",
},
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.setData({ lineItems: lineItems });
await wrapper.vm.$nextTick();
// Act
const testValue = wrapper.vm.shouldHideRecalibration;
// Assert
expect(testValue).toEqual(true);
});
test("Itac/NoComp with Recal should return false for shouldHideRecalibration", async () => {
//Arrange
const { wrapper } = setupMocks({});
const lineItems = {
glassParts: [
{
partType: "RECALIBRATION",
},
],
};
wrapper.vm.submittedOrder = {
vehicle: {
imageUrl: "",
},
schedule: {
endTime: "10:00",
date: "2024-09-28",
jobMaxMinutes: 120,
jobMinMinutes: 60,
routeCode: "",
},
policy: {
isItac: true,
isNoComp: false,
},
serviceLocation: store.getters.order.serviceLocation,
};
wrapper.setData({ lineItems: lineItems });
await wrapper.vm.$nextTick();
// Act
const testValue = wrapper.vm.shouldHideRecalibration;
// Assert
expect(testValue).toEqual(false);
});
});
function setupMocks({ customMountOptions }) {

View file

@ -103,6 +103,7 @@ import { get12HourTimeFormat, get12HourTimeMobileFormat } from "@/helpers/date-h
import { coverageStatus } from "@/constants/insurance";
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
import { experimentSettings } from "@/constants/experiments";
import experimentMixin from "@/mixins/experiment-mixin.js";
import { partTypeStrings } from "@/constants/part-type-strings";
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
import { containsRecalParts } from "@/helpers/recal-helper.js";
@ -151,12 +152,29 @@ export default {
const availableVaps = [resultMap.rainDefense, ...resultMap.wipers];
const lineItemsFromSubmittedOrder = deepClone(submittedOrder.lineItems);
const isNoComp = submittedOrder?.policy?.isNoComp;
const isItac = submittedOrder?.policy?.isItac;
const isRecalibrationOnOrder = containsRecalParts(lineItemsFromSubmittedOrder);
const hasRecalPriceRemoveExperiment =
experimentMixin.methods
.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)
?.toLowerCase() === "true";
const shouldHideRecalibration = () => {
if (isNoComp || isItac) {
return false;
}
return hasRecalPriceRemoveExperiment && isRecalibrationOnOrder;
};
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
vm.lineItems = lineItemsFromSubmittedOrder;
vm.vaps = availableVaps;
vm.submittedOrder = submittedOrder;
vm.shouldHideRecalibration = shouldHideRecalibration();
});
},
data() {
@ -164,22 +182,13 @@ export default {
lineItems: [],
vaps: [],
submittedOrder: null,
shouldHideRecalibration: null,
};
},
computed: {
isRecalibrationOnOrder() {
return containsRecalParts(this?.lineItems);
},
shouldHideRecalibration() {
if (this.isNoComp || this.isItac) {
return false;
}
return (
this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)?.toLowerCase() ===
"true" && this.isRecalibrationOnOrder
);
},
ShowCart() {
if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) {
// settleTenderAmount always shows 0 via localhost or dev.

View file

@ -113,5 +113,7 @@ function setupMocks() {
const wrapper = shallowMount(customerDetails, mountOptions);
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
return { wrapper };
}

View file

@ -525,6 +525,8 @@ export default {
async forwardButtonAction() {
this.forwardClicked = true;
this.$refs.loadingModal.showModal();
await this.dispatchStoreAction(
storeActions.SAVE_PAYMENT_METHOD_CHOICE,
this.paymentMethod,
@ -575,7 +577,6 @@ export default {
}
},
async setupPia() {
this.$refs.loadingModal.showModal();
// we need a work order number for pia so we can pass it to safeliteHop.
// this will create one in delete substatus.
try {

View file

@ -436,8 +436,15 @@ export default {
(!this.isRecalibrationOnOrder || !this.shouldHideRecalibration)
);
},
isRecalPriceRemove() {
return (
experimentMixin.methods
.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)
?.toLowerCase() === "true"
);
},
showRecalDisclaimer() {
return this.isRecalibrationOnOrder && this.shouldHideRecalibration;
return this.isRecalibrationOnOrder && this.isRecalPriceRemove;
},
},
methods: {

View file

@ -826,6 +826,10 @@ export const getters = {
order = state.order;
}
if (order.payment.isInsurance) {
return false;
}
return (
experimentMixin.methods
.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)