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

View file

@ -559,140 +559,6 @@ describe("computed properties...", () => {
// Assert // Assert
expect(testValue).toEqual("Duration: Overnight"); 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 }) { function setupMocks({ customMountOptions }) {

View file

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

View file

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

View file

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

View file

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

View file

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