Merge pull request #2195 from Safelite/rlsmerge/2025.01.09-to-01.16
Rlsmerge/2025.01.09 to 01.16
This commit is contained in:
commit
80d3087363
9 changed files with 97 additions and 57 deletions
|
|
@ -42,13 +42,10 @@ export async function getDirectNavigation(toRoute) {
|
|||
return fmgPageValues.VEHICLE_DAMAGE;
|
||||
}
|
||||
|
||||
if (
|
||||
fmgPageValue === fmgPageValues.QUOTE ||
|
||||
fmgPageValue === fmgPageValues.INSURANCE_COMPANY
|
||||
) {
|
||||
if (fmgPageValue === fmgPageValues.QUOTE) {
|
||||
const skipVin = await skipVinLookup();
|
||||
|
||||
if (skipVin) {
|
||||
if (skipVin || !store.getters.vehicle?.vin) {
|
||||
return fmgPageValues.ESTIMATE;
|
||||
} else {
|
||||
return fmgPageValues.VIN_LOOKUP;
|
||||
|
|
|
|||
|
|
@ -400,26 +400,6 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
// Assert
|
||||
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||
});
|
||||
|
||||
test("Replace navigation to `insurance-company` with `estimate`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.INSURANCE_COMPANY,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.ESTIMATE);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Vin-Required", () => {
|
||||
|
|
@ -438,29 +418,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
|
||||
{ glassLocation: glassLocations.WINDSHIELD },
|
||||
]);
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(fmgPageValues.VIN_LOOKUP);
|
||||
});
|
||||
|
||||
test("Replace navigation to `insurance-company` with `vin-lookup`", async () => {
|
||||
// Arrange
|
||||
const toRoute = {
|
||||
query: {
|
||||
fmgPage: fmgPageValues.INSURANCE_COMPANY,
|
||||
},
|
||||
};
|
||||
|
||||
store.commit(storeMutations.UPDATE_IS_VERIFIED_INSURANCE, true);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, "666666");
|
||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||
store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [
|
||||
{ glassLocation: glassLocations.WINDSHIELD },
|
||||
]);
|
||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, "abcd1234");
|
||||
|
||||
// Act
|
||||
const result = await getPageToRouteExistingOrderTo(toRoute);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ import { required, regex } from "@/helpers/validation-rules";
|
|||
import { Form, defineRule } from "vee-validate";
|
||||
import { useField, validate } from "vee-validate";
|
||||
import store from "@/store";
|
||||
import { paymentMethods } from "@/constants/payment-method-constants";
|
||||
|
||||
// DEFINE VALIDATION RULES
|
||||
defineRule("first-name-required", required(errorMessages.FIRST_NAME_REQUIRED));
|
||||
|
|
@ -162,7 +163,7 @@ export default {
|
|||
backButtonAction() {
|
||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||
},
|
||||
forwardButtonAction() {
|
||||
async forwardButtonAction() {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_CUSTOMER_DETAILS,
|
||||
{
|
||||
|
|
@ -181,6 +182,17 @@ export default {
|
|||
false
|
||||
);
|
||||
|
||||
// if the user has resorted to using browser back/forward buttons we could have promises unresolved if they clicked back before pia work order submission.
|
||||
// so attempt to wait for them to finish.
|
||||
if (store.getters.order.payment.isPia) {
|
||||
this.dispatchStoreAction(
|
||||
storeActions.SAVE_PAYMENT_METHOD_CHOICE,
|
||||
paymentMethods.NONE,
|
||||
false
|
||||
);
|
||||
await store.getters.applicationUser.saveSessionPromise;
|
||||
}
|
||||
|
||||
this.$router.navigateWithSaving(this.navigationScenarios.CLICKED_FORWARD, this.$route);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -202,6 +202,9 @@ describe("payment.vue", () => {
|
|||
jobMaxMinutes: "45",
|
||||
},
|
||||
},
|
||||
applicationUser: {
|
||||
loggingOption: false,
|
||||
},
|
||||
policy: {
|
||||
currentDeductible: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -532,13 +532,53 @@ export default {
|
|||
store.getters.order.payment.isPia !== null &&
|
||||
(store.getters.order.payment.isPia || !!store.getters.order.payment.piaType);
|
||||
|
||||
return (
|
||||
const preReqResult =
|
||||
serviceLocationReqs &&
|
||||
isInsuranceSet &&
|
||||
scheduleReqs &&
|
||||
customerReqs &&
|
||||
paymentMethodReqs
|
||||
);
|
||||
paymentMethodReqs;
|
||||
|
||||
// prettier-ignore
|
||||
{
|
||||
if (store.getters.applicationUser.loggingOption || !preReqResult) {
|
||||
console.log("------------- payment.vue pagePrereqs start -----------------");
|
||||
console.log(new Date() + "mobileReqs:" + mobileReqs);
|
||||
console.log(new Date() + "serviceLocation.address:" + serviceLocation.address);
|
||||
console.log(new Date() + "serviceLocation.city:" + serviceLocation.city);
|
||||
console.log(new Date() + "serviceLocation.state:" + serviceLocation.state);
|
||||
console.log(new Date() + "serviceLocation.zipCode:" + serviceLocation.zipCode);
|
||||
console.log("");
|
||||
console.log(new Date() + "dropOffInshopReqs:" + dropOffInshopReqs);
|
||||
console.log(new Date() + "serviceLocationReqs:" + serviceLocationReqs);
|
||||
console.log(new Date() + "providerLocation.streetAddress:" + providerLocation.streetAddress);
|
||||
console.log(new Date() + "providerLocation.city:" + providerLocation.city);
|
||||
console.log(new Date() + "providerLocation.state:" + providerLocation.state);
|
||||
console.log(new Date() + "providerLocation.zipCode:" + providerLocation.zipCode);
|
||||
console.log("");
|
||||
console.log(new Date() + "isInsuranceSet:" + isInsuranceSet);
|
||||
console.log("");
|
||||
console.log(new Date() + "scheduleReqs:" + scheduleReqs);
|
||||
console.log(new Date() + "schedule.date:" + schedule.date);
|
||||
console.log(new Date() + "schedule.startTime:" + schedule.startTime);
|
||||
console.log(new Date() + "schedule.endTime:" + schedule.endTime);
|
||||
console.log(new Date() + "schedule.jobMaxMinutes:" + schedule.jobMaxMinutes);
|
||||
console.log(new Date() + "schedule.jobMinMinutes:" + schedule.jobMinMinutes);
|
||||
console.log("");
|
||||
console.log(new Date() + "customerReqs:" + customerReqs);
|
||||
console.log(new Date() + "customer.firstName:" + customer.firstName);
|
||||
console.log(new Date() + "customer.lastName:" + customer.lastName);
|
||||
console.log(new Date() + "customer.phoneNumber:" + customer.phoneNumber);
|
||||
console.log(new Date() + "customer.emailAddress:" + customer.emailAddress);
|
||||
console.log("");
|
||||
console.log(new Date() + "paymentMethodReqs:" + paymentMethodReqs);
|
||||
console.log(new Date() + "store.getters.order.payment.isPia:" + store.getters.order.payment.isPia);
|
||||
console.log(new Date() + "store.getters.order.payment.piaType:" + store.getters.order.payment.piaType);
|
||||
console.log("------------- payment.vue pagePrereqs end -------------------");
|
||||
}
|
||||
}
|
||||
|
||||
return preReqResult;
|
||||
},
|
||||
getWOrkOrderNumber() {
|
||||
if (store.getters.order.workOrderNumber) {
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ export default {
|
|||
!options.length ||
|
||||
store.getters.payment?.insuranceCoverage?.isVerified ||
|
||||
(store.getters.order.payment?.isInsurance &&
|
||||
getFunnelCookie().HasDelayedClaimRegistration)
|
||||
getFunnelCookie()?.HasDelayedClaimRegistration)
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ const routes = [
|
|||
store.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
||||
}
|
||||
setupAdvertiserTracking();
|
||||
log(" --load session start");
|
||||
const loadSessionResponse = await loadSessionIfPresent(
|
||||
to.query.isInsurance != null
|
||||
? to.query.isInsurance == "true"
|
||||
|
|
@ -121,6 +122,7 @@ const routes = [
|
|||
: null,
|
||||
to.query.fmgPage
|
||||
);
|
||||
log(" --load session end");
|
||||
|
||||
//Update external parameter state but not when returning from heritage
|
||||
if (!to.query.fmgPage?.startsWith("service-location")) {
|
||||
|
|
@ -155,7 +157,10 @@ const routes = [
|
|||
// Reroute around pages that should not be available.
|
||||
|
||||
// Exception 1: Integrated Users should not see vehicle or quote pages.
|
||||
if (store.getters.payment?.insuranceCoverage?.isVerified) {
|
||||
if (
|
||||
store.getters.payment?.insuranceCoverage?.isVerified ||
|
||||
store.getters.order?.referralNumber?.length === 6
|
||||
) {
|
||||
if (to.query.fmgPage === fmgPageValues.VEHICLE) {
|
||||
to.query.fmgPage = fmgPageValues.VEHICLE_DAMAGE;
|
||||
} else if (
|
||||
|
|
@ -194,6 +199,13 @@ const routes = [
|
|||
|
||||
if (!arePagePrerequisitesValid(component)) {
|
||||
console.log("Page prereq error: " + component.default.name);
|
||||
|
||||
if (to.query.fmgPage === fmgPageValues.PAYMENT) {
|
||||
await store.getters.applicationUser.saveSessionPromise;
|
||||
window.location = applicationConfig.PIA_CANCEL_URL;
|
||||
return;
|
||||
}
|
||||
|
||||
GoToFunnelStartOn404(next);
|
||||
}
|
||||
|
||||
|
|
@ -380,6 +392,8 @@ router.navigateWithSaving = (
|
|||
};
|
||||
|
||||
router.navigateToExternalUrl = (url, optionalQuery = {}) => {
|
||||
log("------------- router navigateToExternalUrl -----------------");
|
||||
log("url:", url);
|
||||
navigateToUrl(url, optionalQuery);
|
||||
};
|
||||
|
||||
|
|
@ -397,6 +411,13 @@ router.overrideNavigation = (
|
|||
optionalParams = {},
|
||||
optionalPageData
|
||||
) => {
|
||||
log("------------- router overrideNavigation -----------------");
|
||||
log("scenario:", scenario);
|
||||
log("currentRoute:", currentRoute);
|
||||
log("isSavingNavigation:", isSavingNavigation);
|
||||
log("optionalQuery:", optionalQuery);
|
||||
log("optionalParams:", optionalParams);
|
||||
log("optionalPageData:", optionalPageData);
|
||||
navigate(
|
||||
scenario,
|
||||
currentRoute,
|
||||
|
|
@ -508,6 +529,9 @@ async function navigate(
|
|||
// Get navigation map depending on the scenario and the current 'page' you're on.
|
||||
function getNavigationMap(scenario, currentRoute) {
|
||||
const fmgPageValue = currentRoute.query.fmgPage;
|
||||
log("------------- router index.js getNavigationMap start -----------------");
|
||||
log("fmgPage: " + fmgPageValue + " scenario: " + scenario, "");
|
||||
log("------------- router index.js getNavigationMap end -----------------");
|
||||
const matchedQueryValue = routingTable(store)
|
||||
.filter(
|
||||
(item) =>
|
||||
|
|
@ -525,7 +549,7 @@ function log(message, data) {
|
|||
data = data ?? "";
|
||||
const outData = typeof data === "object" ? JSON.stringify(data) : data;
|
||||
|
||||
if (log === "true") {
|
||||
if (log === "true" || store.getters.applicationUser.loggingOption) {
|
||||
console.log(new Date() + message + outData);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -470,6 +470,10 @@ const routingTable = function (store) {
|
|||
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||
destinationFmgPageValue: fmgPageValues.PAYMENT_METHOD,
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_PAY_NOW,
|
||||
destinationFmgPageValue: fmgPageValues.PAYMENT_METHOD,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2509,10 +2509,12 @@ export const actions = {
|
|||
},
|
||||
|
||||
savePaymentMethodChoice(context, paymentMethod) {
|
||||
const isPia = paymentMethod !== paymentMethods.LATER;
|
||||
var isPia = null;
|
||||
if (paymentMethod !== paymentMethods.NONE) {
|
||||
isPia = paymentMethod !== paymentMethods.LATER;
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_IS_PIA, isPia);
|
||||
|
||||
context.commit(storeMutations.UPDATE_PIA_TYPE, isPia ? paymentMethod : null);
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue