CSR-98 Save on every page and redirect to heritage funnel on one
This commit is contained in:
parent
edda638d4f
commit
6ce8bbec8a
9 changed files with 91 additions and 31 deletions
|
|
@ -15,6 +15,11 @@ const storeMutations = {
|
|||
UPDATE_GLASS_TO_REPLACE: "updateGlassToReplace",
|
||||
UPDATE_PARTS: "updateParts",
|
||||
|
||||
// ORDER MUTATIONS
|
||||
UPDATE_REFERRAL_NUMBER: "updateReferralNumber",
|
||||
UPDATE_REFERRAL_DATE: "updateReferralDate",
|
||||
UPDATE_REFERRAL_CORRELATION_ID: "updateReferralCorrelationId",
|
||||
|
||||
// EVENT BUS MUTATIONS
|
||||
ADD_EVENT_TO_BUS: "addEventToBus",
|
||||
REMOVE_EVENT_FROM_BUS: "removeEventFromBus",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,15 @@ import httpStatusCodes from "http-status-codes";
|
|||
export default {
|
||||
callHttpClient({ method, endpoint, payload }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL;
|
||||
// TODO CSR-98 TEMP FOR TESTING
|
||||
var apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL;
|
||||
|
||||
if (endpoint.includes("order")) {
|
||||
apiGatewayUrl = "https://localhost:44346";
|
||||
}
|
||||
|
||||
|
||||
// const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL;
|
||||
const payloadAndAnalyticsData = Object.assign({}, payload, {
|
||||
AppName: "FixMyGlass",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
v-model="selectedRearReplaceOptions"
|
||||
groupName="BackGlassReplaceOptionsQuestion"
|
||||
/>
|
||||
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" @forward-clicked="forwardButtonAction" />
|
||||
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" @ForwardClicked="forwardButtonAction" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -49,6 +49,7 @@ import baseMixin from "@/mixins/base-mixin";
|
|||
import { damageLocationsParts } from "@/constants/damage-locations-parts.js";
|
||||
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
||||
|
||||
|
||||
export default {
|
||||
name: "vehicle-damage",
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
|
|
@ -129,6 +130,7 @@ export default {
|
|||
this.$route
|
||||
);
|
||||
},
|
||||
|
||||
async forwardButtonAction() {
|
||||
var windshieldChipCount = this.selectedWindshieldOptions.selectedWindshieldChipCount && this.isWindshieldDamageLocation ?
|
||||
this.selectedWindshieldOptions.selectedWindshieldChipCount[0] : null;
|
||||
|
|
@ -144,25 +146,10 @@ export default {
|
|||
var partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS,
|
||||
{ carId: store.getters.vehicle.carId, glassArray: this.selectedGlassToReplace()}, false);
|
||||
|
||||
/******** START CSR-98 ********/
|
||||
var savedOrderInfo = await baseMixin.methods.dispatchNonBlockingStoreAction(this.storeActions.SAVE_ORDER);
|
||||
console.log(savedOrderInfo)
|
||||
/******** END CSR-98 ********/
|
||||
|
||||
this.navigateForward(partsData);
|
||||
},
|
||||
|
||||
navigateForward(partsData){
|
||||
/******** START CSR-98 ********/
|
||||
console.log("Get estimate!")
|
||||
|
||||
// this.$router.navigate(
|
||||
// this.navigationScenarios.CLICKED_FORWARD,
|
||||
// this.$route
|
||||
// );
|
||||
/******** END CSR-98 ********/
|
||||
|
||||
|
||||
|
||||
//found problem questions
|
||||
if (partsData.data.partsOrQuestions.some(pq => pq.partQuestions != null && pq.partQuestions.length > 0)){
|
||||
this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, this.$route, {}, {}, partsData.data);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import { storeActions } from "@/constants/store-actions.js";
|
||||
import { storeMutations } from "@/constants/store-mutations.js";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { widgetNames } from "@/constants/widget-names.js";
|
||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
|
@ -20,6 +22,30 @@ export default {
|
|||
},
|
||||
savePageDataToStore(page, data){
|
||||
store.commit(storeMutations.UPDATE_PAGE_DATA, { page: page, data: data });
|
||||
},
|
||||
async saveOrder() {
|
||||
var savedOrderInfo = (await this.dispatchNonBlockingStoreAction(storeActions.SAVE_ORDER)).data;
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, savedOrderInfo.referralNumber);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_DATE, savedOrderInfo.referralDate);
|
||||
store.commit(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, savedOrderInfo.referralCorrelationId);
|
||||
|
||||
// console.log(router)
|
||||
// console.log(router.currentRoute.value.name)
|
||||
// if (router.currentRoute.value.name)
|
||||
// this.navigateToHeritageFunnel()
|
||||
},
|
||||
navigateToHeritageFunnel() {
|
||||
console.log("Get estimate!")
|
||||
var referralCorrelationId = store.getters.referralCorrelationId;
|
||||
|
||||
router.navigate(
|
||||
navigationScenarios.CLICKED_FORWARD,
|
||||
router.currentRoute.value,
|
||||
{
|
||||
corid: referralCorrelationId,
|
||||
src: "concept-funnel"
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,9 @@ function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery = {},
|
|||
return;
|
||||
}
|
||||
|
||||
// here?? CSR-98
|
||||
baseMixin.methods.saveOrder();
|
||||
|
||||
// Match our maps up and navigate if we have a destination.
|
||||
const matchingScenarioMap = getNavigationMap(scenario, currentRoute);
|
||||
|
||||
|
|
@ -148,6 +151,10 @@ function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery = {},
|
|||
// Append page data to the store for the NEXT page, if any. It will be an empty object if none is provided.
|
||||
baseMixin.methods.savePageDataToStore(matchingScenarioMap.destinationFmgPageValue, optionalPageData);
|
||||
|
||||
// TODO CSR-98 don't hardcode this
|
||||
if (currentRoute.name == "vehicle-damage")
|
||||
baseMixin.methods.navigateToHeritageFunnel()
|
||||
else {
|
||||
router.push({
|
||||
name: "root",
|
||||
query: Object.assign(optionalQuery, {
|
||||
|
|
@ -155,8 +162,9 @@ function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery = {},
|
|||
}),
|
||||
params: optionalParams,
|
||||
});
|
||||
}
|
||||
} else if (matchingScenarioMap.destinationUrl !== undefined) {
|
||||
navigateToUrl(matchingScenarioMap.destinationUrl);
|
||||
navigateToUrl(matchingScenarioMap.destinationUrl, optionalQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +185,14 @@ function getNavigationMap(scenario, currentRoute) {
|
|||
//---------------------------------------------------------- Private Functions ----------------------------------------------------------
|
||||
|
||||
// Navigate to an external url.
|
||||
function navigateToUrl(url) {
|
||||
function navigateToUrl(url, optionalQuery) {
|
||||
// possibly show some loading screen in the future here.
|
||||
window.location.assign(url);
|
||||
var externalUrl = new URL(url);
|
||||
|
||||
for (const queryKey in optionalQuery) {
|
||||
externalUrl.searchParams.append(queryKey, optionalQuery[queryKey]);
|
||||
}
|
||||
window.location.assign(externalUrl);
|
||||
}
|
||||
|
||||
// Get route information by page name.
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ const routingTable = [
|
|||
scenario: navigationScenarios.SELECTED_PARTS,
|
||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||
destinationUrl: externalUrls.HERITAGE_FUNNEL,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@ export const state = {
|
|||
glassParts: null,
|
||||
otherParts: null
|
||||
},
|
||||
referralSeqNum: null,
|
||||
correlationId: null,
|
||||
referralNumber: null,
|
||||
referralDate: null,
|
||||
referralCorrelationId: null,
|
||||
},
|
||||
applicationUser: {
|
||||
eventBus: [],
|
||||
|
|
@ -83,6 +84,15 @@ export const mutations = {
|
|||
updatePageData(state, pageData){
|
||||
state.applicationUser.pageData[pageData.page] = pageData.data;
|
||||
},
|
||||
updateReferralCorrelationId(state, referralCorrelationId) {
|
||||
state.order.referralCorrelationId = referralCorrelationId;
|
||||
},
|
||||
updateReferralNumber(state, referralNumber) {
|
||||
state.order.referralNumber = referralNumber;
|
||||
},
|
||||
updateReferralDate(state, referralDate) {
|
||||
state.order.referralDate = referralDate;
|
||||
},
|
||||
|
||||
// EVENT BUS MUTATIONS
|
||||
addEventToBus(state, event) {
|
||||
|
|
@ -144,6 +154,9 @@ export const getters = {
|
|||
eventBus: (state) => state.applicationUser.eventBus,
|
||||
damage: (state) => state.order.damage,
|
||||
lineItems: (state) => state.order.lineItems,
|
||||
referralNumber: (state) => state.order.referralNumber,
|
||||
referralDate: (state) => state.order.referralDate,
|
||||
referralCorrelationId: (state) => state.order.referralCorrelationId,
|
||||
pageData: (state) => (page) => {
|
||||
return state.applicationUser.pageData[page];
|
||||
}
|
||||
|
|
@ -300,6 +313,9 @@ export const actions = {
|
|||
style: vehicle.style,
|
||||
},
|
||||
numberOfChips: damage.numberOfChips,
|
||||
glassToReplace: damage.glassToReplace,
|
||||
referralNumber: context.getters.referralNumber,
|
||||
referralDate: context.getters.referralDate
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -23,5 +23,5 @@ module.exports = {
|
|||
},
|
||||
configureWebpack: {
|
||||
devtool: 'source-map'
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
process.env.VUE_APP_CONSUMER_API_GATEWAY = "__VUE_APP_CONSUMER_API_GATEWAY__";
|
||||
process.env.VUE_APP_HERITAGE_FUNNEL = "__VUE_APP_HERITAGE_FUNNEL__";
|
||||
|
||||
module.exports = {
|
||||
outputDir: "dist/fmg",
|
||||
|
|
|
|||
Loading…
Reference in a new issue