Merge branch 'develop' into feature/Digital/CSR-1629

This commit is contained in:
hiteshkumar87 2024-09-04 14:59:36 +05:30 committed by GitHub
commit 663c1d90e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 21 deletions

View file

@ -525,14 +525,18 @@ export default {
await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true });
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_FORWARD,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_PIA_ALERT]: false }
);
} else {
if (this.paymentMethod == paymentMethods.INSURANCE) {
this.dispatchStoreAction(this.storeActions.SAVE_PAYMENT_TYPE, true, false);
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_INSURANCE,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_PIA_ALERT]: false }
);
} else {
this.setupPia();
@ -554,14 +558,16 @@ export default {
} catch (error) {
console.log("error: response from pia submit work order:" + error.message);
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
this.$route.params[routerParams.DISPLAY_PIA_ALERT] = true;
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] = true;
return;
}
}
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
this.$router.navigateWithoutSaving(
this.navigationScenarios.CLICKED_PAY_NOW,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_PIA_ALERT]: false }
);
},
hasSubmittedOrder() {
@ -682,7 +688,7 @@ export default {
shouldDisplayPiaAlert() {
return (
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] ||
this.$route.params[routerParams.DISPLAY_PIA_ALERT]
eval(window.history.state.displayPiaAlert)
);
},
// Necessary to make the watcher of lineItems work

View file

@ -747,7 +747,7 @@ export default {
shouldDisplayPiaAlert(payMethod) {
return (
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] === payMethod ||
this.$route.params[routerParams.DISPLAY_PIA_ALERT] === payMethod
eval(window.history.state.displayPiaAlert)
);
},
},

View file

@ -310,12 +310,11 @@ describe("vehicle-damage.vue", () => {
describe("alert", () => {
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
// Arrange & Act
window.history.pushState({ displayVehicleChangeAlert: "true" }, "", "");
const { wrapper } = setupMocks({
mountOptionsMockData: {
route: {
params: {
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true,
},
state: { displayVehicleChangeAlert: true },
},
},
});
@ -325,21 +324,24 @@ describe("vehicle-damage.vue", () => {
test("when displayVehicleChangeAlert router params is false, the alert: 'vehicleChangeAlert' should not be rendered", () => {
// Arrange & Act
window.history.pushState({ displayVehicleChangeAlert: "false" }, "", "");
const { wrapper } = setupMocks({
mountOptionsMockData: {
route: {
params: {
state: {
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
},
},
},
});
// Assert
expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false);
});
test("when displayVehicleChangeAlert router params is undefined, the alert: 'vehicleChangeAlert' should not be rendered", () => {
// Arrange & Act
window.history.pushState({ displayVehicleChangeAlert: "false" }, "", "");
const { wrapper } = setupMocks({
mountOptionsMockData: {
route: {
@ -850,7 +852,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
navigateWithSaving: jest.fn(),
},
route: {
params: {
state: {
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
},
},

View file

@ -103,6 +103,7 @@ import { errorMessages } from "@/constants/error-messages";
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
import { routerParams } from "@/router/router-constants/router-params";
import store from "@/store";
import baseMixin from "@/mixins/base-mixin";
@ -405,20 +406,26 @@ export default {
if (skipVin) {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
} else {
if (store.getters.damage.isRepair) {
this.$router.navigateWithSaving(
this.navigationScenarios
.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
} else {
this.$router.navigateWithSaving(
this.navigationScenarios
.CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
}
}
@ -427,17 +434,23 @@ export default {
else if (store.getters.vehicle.vin) {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
} else if (skipVin) {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
} else {
this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
this.$route
this.$route,
{},
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
);
}
},
@ -566,7 +579,7 @@ export default {
);
},
shouldDisplayVehicleChangeAlert() {
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
return eval(window.history.state.displayVehicleChangeAlert);
},
shouldHideBackButton() {
return this.$store.getters.requiresVerifiedRedirecting;

View file

@ -398,6 +398,8 @@ async function navigate(
: (existingPageDataForPage ?? {})
);
optionalParams.isSavingNavigation = isSavingNavigation;
// add querystring params to the route. if they are already in the store then no need to add them
var queryStringsObject = {
fmgPage: destinationFmgPageValue,
@ -429,9 +431,7 @@ async function navigate(
router.push({
name: "root",
query: Object.assign(optionalQuery, queryStringsObject),
state: {
isSavingNavigation: isSavingNavigation,
},
state: optionalParams,
});
} else if (matchingScenarioMap.destinationUrl !== undefined) {
navigateToUrl(matchingScenarioMap.destinationUrl, optionalQuery);