Merge branch 'release/2024.11.21' into rlsmerge/2024.11.21-to-develop

This commit is contained in:
CarlNation 2024-11-15 14:30:09 -05:00
commit 5e479de701
11 changed files with 110 additions and 165 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

@ -30,11 +30,14 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}) {
export async function getDirectNavigation(toRoute) {
const fmgPageValue = toRoute.query[queryStrings.FMG_PAGE];
// Verified insurance users need to be routed around some pages
// Verified insurance users need to be routed around some pages. Same goes for C&C unverified 6 digit referrals
// vehicle -> vehicle-damage
// quote -> vin-lookup/estimate
// insurance-company -> vin-lookup/estimate
if (store.getters.payment?.insuranceCoverage?.isVerified) {
if (
store.getters.payment?.insuranceCoverage?.isVerified ||
store.getters.order?.referralNumber?.length === 6
) {
if (fmgPageValue === fmgPageValues.VEHICLE) {
return fmgPageValues.VEHICLE_DAMAGE;
}
@ -108,7 +111,7 @@ export async function getImplicitNavigation(toRoute) {
export async function navigateToHeritageFunnel({ shouldSaveSession, pageNameToLog }) {
const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log)) {
if (log === "true") {
console.log("------------- Navigate to heritage start -----------------");
console.log(new Date() + " applicationConfig: " + JSON.stringify(applicationConfig));
console.log(new Date() + " navigateToHeritageFunnel: " + applicationConfig.HERITAGE_FUNNEL);

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.
@ -332,11 +341,17 @@ export default {
return `Between ${get12HourTimeMobileFormat(
this.ScheduleStartTime
)} - ${get12HourTimeMobileFormat(this.ScheduleEndTime)}`;
} else if (this.AppointmentType == AppointmentTypeStrings.DROP_OFF) {
return `Drop off before 9:30 AM`;
} else {
return `at ${get12HourTimeFormat(this.ScheduleStartTime)}`;
}
if (this.AppointmentType == AppointmentTypeStrings.DROP_OFF) {
if (
this.submittedOrder?.schedule?.routeCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)
) {
return `Drop off before 5:30 PM`;
} else {
return `Drop off before 9:30 AM`;
}
}
return `at ${get12HourTimeFormat(this.ScheduleStartTime)}`;
},
vehicleBannerImageUrl() {
return this.submittedOrder?.vehicle.imageUrl;

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

@ -348,7 +348,7 @@ export default {
// prettier-ignore
{
const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log)) {
if (log === "true") {
console.log("------------- quote.vue thresholds start -----------------");
console.log(new Date() + " isExternalParameter: " + isExternalParameter);
console.log(new Date() + " internalThreshold: " + internalThreshold);
@ -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: {
@ -459,7 +466,7 @@ export default {
// prettier-ignore
{
const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log) || !preReqResult) {
if (log === "true" || !preReqResult) {
console.log("------------- quote.vue pagePrereqs start -----------------");
console.log(new Date() + " store.getters.order.serviceLocation.zipCode: " + store.getters.order.serviceLocation?.zipCode);
console.log(new Date() +" store.getters.order.serviceLocation.zipCodeCtu: " + store.getters.order.serviceLocation?.zipCodeCtu);

View file

@ -326,7 +326,7 @@ export default {
// prettier-ignore
{
const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log) || !preReqResult) {
if (log === "true" || !preReqResult) {
console.log("------------- schedule.vue pagePrereqs start -----------------");
console.log(new Date() + " store.getters.order.serviceLocation.zipCode: " + serviceLocation.zipCode);
console.log(new Date() + " store.getters.order.serviceLocation.zipCodeCtu: " + serviceLocation.zipCodeCtu);

View file

@ -122,7 +122,7 @@ export default {
async beforeRouteEnter(to, from, next) {
const log = getQuerystringParameter(queryStrings.LOG);
if (eval(log)) {
if (log === "true") {
console.log("----------------- applicationConfig start -----------------");
console.log(new Date() + JSON.stringify(applicationConfig));
console.log("----------------- applicationConfig end -----------------");

View file

@ -50,15 +50,21 @@ const routes = [
async beforeEnter(to, from, next) {
// If we have no query string, or we don't have the FmgPage query string.
try {
log("------------- router index.js beforeEnter start -----------------");
log(" --to: ", to);
log(" --cookie: ", getFunnelCookie());
await analyticsMixin.methods.validateSession();
if (getFunnelCookie()?.SuppressConceptFunnel) {
log(" --go to heritage suppressConceptFunnel: ");
await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false);
}
// If the saved session has timed out, clear the session, execute 404 logic.
if (getFunnelCookie() !== null && !isSavedSessionStillActive()) {
log(" --save session timeout go to start");
await baseMixin.methods.dispatchStoreAction(storeActions.RESET_STATE);
deleteFunnelCookie();
GoToFunnelStartOn404(next);
@ -68,12 +74,14 @@ const routes = [
if (window.sessionStorage.getItem("submittedOrder") !== null) {
if (to.query.fmgPage !== funnelStartPageName) {
to.query.fmgPage = fmgPageValues.CONFIRMATION;
log(" --has submittedOrder go to confirmation");
}
}
// On entering the funnel "fresh", read cookie information, decide what to do next.
else if (from.redirectedFrom === undefined) {
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
// the saveSessionPromise will no longer point to a valid promise
log(" --clear promise");
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
if (!to.query.fmgPage?.startsWith("payment")) {
@ -95,6 +103,7 @@ const routes = [
storeMutations.UPDATE_REFERRAL_CORRELATION_ID,
correlationId
);
log(" --update cookie");
updateOrCreateFunnelCookie();
}
@ -127,15 +136,19 @@ const routes = [
}
const pageToRedirectTo = await getPageToRouteExistingOrderTo(to);
log(" --pageToRedirectTo ", JSON.stringify(pageToRedirectTo));
// This logic may determine that the user should be sent to heritage -- if so, do that here.
if (pageToRedirectTo === fmgPageValues.HERITAGE) {
// prettier-ignore
log(" --go to heritage pageToRedirectTo ", JSON.stringify(pageToRedirectTo));
await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false);
}
// Assign our fmgPage so it will load normally like the other pages.
to.query.fmgPage = pageToRedirectTo;
log(" --assign to: ", JSON.stringify(pageToRedirectTo));
}
}
@ -149,6 +162,7 @@ const routes = [
to.query.fmgPage === fmgPageValues.QUOTE ||
to.query.fmgPage === fmgPageValues.INSURANCE_COMPANY
) {
log(" --block quote page for integrated clients - go to heritage");
// Push to heritage if going to quote & integrated.
await navigateToHeritageFunnel({ shouldSaveSession: false });
return next(false);
@ -183,6 +197,7 @@ const routes = [
GoToFunnelStartOn404(next);
}
log(" --has route:", to.query.fmgPage);
return next({ name: to.query.fmgPage, query: to.query, params: to.params });
}
@ -210,12 +225,13 @@ const routes = [
.components.default();
if (!arePagePrerequisitesValid(nextComponent)) {
console.log(
"Page Prereqs not valid for next component: " + nextComponent.default.name
);
// prettier-ignore
console.log("Page Prereqs not valid for next component: " + nextComponent.default.name);
GoToFunnelStartOn404(next);
}
log("------------- router index.js beforeEnter end -----------------");
// Assign current query string parameters, as well as our fmgPage one.
next({
name: routeData[0].name,
@ -230,6 +246,8 @@ const routes = [
await baseMixin.methods.dispatchStoreAction(storeActions.RESET_STATE);
}
console.log(new Date() + " Exception in beforeEnter:" + JSON.stringify(error));
// If we don't have a route, go to our 404 page.
GoToFunnelStartOn404(next);
}
@ -441,7 +459,15 @@ async function navigate(
const zip = getQuerystringParameter(queryStrings.ZIP_CODE);
const promo = getQuerystringParameter(queryStrings.PROMO);
const pageError = getQuerystringParameter(queryStrings.PAGE_ERROR);
const log = getQuerystringParameter(queryStrings.LOG);
const logQs = getQuerystringParameter(queryStrings.LOG);
log("------------- router index.js navigate start -----------------");
log(" --scenario: ", scenario);
log(" --isSavingNavigation: ", isSavingNavigation);
log(" --optionalQuery: ", optionalQuery);
log(" --optionalParams: ", optionalParams);
log(" --optionalPageData: ", optionalPageData);
log(" --nextPageName: ", nextPageName);
if (
hasZip &&
@ -461,10 +487,13 @@ async function navigate(
queryStringsObject[queryStrings.PAGE_ERROR] = pageError;
}
if (log) {
queryStringsObject[queryStrings.LOG] = log;
if (logQs) {
queryStringsObject[queryStrings.LOG] = logQs;
}
log(" querystrings: ", queryStringsObject);
log("------------- router index.js navigate end -----------------");
router.push({
name: "root",
query: Object.assign(optionalQuery, queryStringsObject),
@ -490,6 +519,16 @@ function getNavigationMap(scenario, currentRoute) {
return matchedQueryValue[0];
}
function log(message, data) {
const log = getQuerystringParameter(queryStrings.LOG);
data = data ?? "";
const outData = typeof data === "object" ? JSON.stringify(data) : data;
if (log === "true") {
console.log(new Date() + message + outData);
}
}
//---------------------------------------------------------- Private Functions ----------------------------------------------------------
// Navigate to an external url.

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)