diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 80c02af69..b46d933c0 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -37,8 +37,8 @@ -
- +
+
@@ -133,6 +133,7 @@ export default { if(this.isMultiSelect && this.selectedValues) { // Add or remove item to array of data to emit const newSelectedValues = this.selectedValues; + if(Array.isArray(this.selectedValues)) { val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; diff --git a/src/constants/cookie-names.js b/src/constants/cookie-names.js new file mode 100644 index 000000000..33a76ae43 --- /dev/null +++ b/src/constants/cookie-names.js @@ -0,0 +1,6 @@ +const cookieNames = { + ORDER_INFO: "OrderInfo" +}; + +export { cookieNames }; + \ No newline at end of file diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 24e5120bd..c547bd28c 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -47,6 +47,10 @@ const endpoints = { url: "/parts/api/v1/parts/parts-or-questions", method: "POST", }, + SaveOrder: { + url: "/order/api/v1/order/save", + method: "POST", + } }; export { endpoints }; diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index e83b44096..84ecf77e6 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -12,12 +12,14 @@ const storeActions = { LOOKUP_VEHICLE_BY_YMMS: "lookupVehicleByYmms", LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin", GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions", + SAVE_ORDER: "saveOrder", // DEPENDENCY MUTATIONS RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies", RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", + RESET_STATE: "resetState", }; export { storeActions }; diff --git a/src/constants/store-mutations.js b/src/constants/store-mutations.js index c07e88bf2..d6ee3b321 100644 --- a/src/constants/store-mutations.js +++ b/src/constants/store-mutations.js @@ -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", @@ -24,6 +29,7 @@ const storeMutations = { RESET_DAMAGE_STATE: "resetDamageState", RESET_REGISTRATION_STATE: "resetRegistrationState", RESET_PARTS_STATE: "resetPartsState", + RESET_STATE: "resetState", // OTHER MUTATIONS UPDATE_PAGE_DATA: "updatePageData", diff --git a/src/global-methods.js b/src/global-methods.js index 788d4c2e4..7d82a2590 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -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", }); diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue index cdbb0c48d..fe43419e8 100644 --- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue +++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue @@ -10,6 +10,7 @@ buttonType="listCard" v-model="selectedValues" :validationRules="validationRules" + :suppressError="suppressError" /> @@ -35,6 +36,7 @@ export default ({ modelValue: Array, isMultiSelect: Boolean, validationRules: String, + suppressError: Boolean, }, methods: { initializeComponent(cmsContent, replaceOptions){ diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 0eb11fbf0..aeb4e8ac6 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -19,6 +19,7 @@ ref="windshieldOptions" v-model="selectedWindshieldOptions" :hasRepairReplaceConflict="hasRepairReplaceConflict" + :hasSplitSingleConflict="hasSplitSingleConflict" :selectedDamageLocations="selectedDamageLocations" /> pq.partQuestions != null && pq.partQuestions.length > 0)){ this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS, this.$route, {}, {}, partsData.data); @@ -392,6 +399,23 @@ export default { hasRepairReplaceConflict() { return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair; }, + hasSplitSingleConflict() { + if (!this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false; + + return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield => + { + return selectedSingleWindshield.toUpperCase() === damageLocationsSelected.SINGLE.toUpperCase(); + }) && + (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedDriverWindshield => + { + return selectedDriverWindshield.toUpperCase() === damageLocationsSelected.DRIVER.toUpperCase(); + }) || + this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedPassengerWindshield => + { + return selectedPassengerWindshield.toUpperCase() === damageLocationsSelected.PASSENGER.toUpperCase(); + }) + ); + }, }, components: { @@ -408,11 +432,3 @@ export default { }, }; - - diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index e94ccc305..30f8c15d7 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -2,14 +2,14 @@
+
@@ -53,17 +62,25 @@ defineRule("checkForRepairAndReplace", (value, [otherFieldValue]) => { Array.isArray(otherFieldValue) && otherFieldValue.length > 1) { - return "checkForRepairAndReplace error" + return false; } return true; }); - defineRule("repairOnly", (value) => { if (value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase()) { return true; } return false; }); +defineRule("preventSplitAndSingleTogether", (value) => { + if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) && + (value.toString().toUpperCase().includes(damageLocationsSelected.DRIVER.toUpperCase()) || + value.toString().toUpperCase().includes(damageLocationsSelected.PASSENGER.toUpperCase()))) + { + return false; + } + return true; +}); export default ({ name: "windshieldOptions", @@ -77,7 +94,8 @@ export default ({ props: { modelValue: Array, selectedDamageLocations: Array, - hasRepairReplaceConflict: Boolean + hasRepairReplaceConflict: Boolean, + hasSplitSingleConflict: Boolean, }, methods: { @@ -91,10 +109,11 @@ export default ({ this.windshieldAvailableReplacementOptions = windshieldAvailableReplacementOptions; }, getWindshieldOptions(selectedWindshieldDamageType, selectedWindshieldChipCount, selectedWindshieldReplaceOptions){ + // ONLY UPDATE THE NEW VALUE IF IT IS TRUTHY (NOT NULL) return { - selectedWindshieldDamageType: selectedWindshieldDamageType, - selectedWindshieldChipCount: selectedWindshieldChipCount, - selectedWindshieldReplaceOptions: selectedWindshieldReplaceOptions + selectedWindshieldDamageType: selectedWindshieldDamageType ? selectedWindshieldDamageType : this.selectedValues.selectedWindshieldDamageType, + selectedWindshieldChipCount: selectedWindshieldChipCount ? selectedWindshieldChipCount : this.selectedValues.selectedWindshieldChipCount, + selectedWindshieldReplaceOptions: selectedWindshieldReplaceOptions ? selectedWindshieldReplaceOptions : this.selectedValues.selectedWindshieldReplaceOptions, } }, }, @@ -150,12 +169,28 @@ export default ({ isWindshieldReplaceAvailable() { return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1); }, - showNoReplaceAvailableError() { + isSplitWindshieldOption() { + const options = this.windshieldAvailableReplacementOptions.toString().toUpperCase(); + if (options.includes('DRIVER') && options.includes('PASSENGER')) { + return true; + } + return false; + }, + showNoReplacementAvailableError() { if (this.isReplaceOptionSelected && !this.isWindshieldReplaceAvailable) { return true; } return false; }, + windshieldDamageTypeQuestionValidationRules() { + // Note: the validation rules string is not dynamic (it cannot be changed once component has been created) + let validationRules = "windshield-damage-type-required|checkForRepairAndReplace:@DamageLocationQuestion"; + // if vehicle has no windshield replacement option + if (!this.isWindshieldReplaceAvailable) { + validationRules = validationRules.concat('|repairOnly'); + } + return validationRules; + } }, components: { windshieldDamageTypeQuestion, diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js new file mode 100644 index 000000000..3d0843e10 --- /dev/null +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -0,0 +1 @@ +test.todo("some test to be written in the future"); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue new file mode 100644 index 000000000..aa179439a --- /dev/null +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index d46841b6a..8fdd6dd8d 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -1,4 +1,5 @@ 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"; @@ -20,6 +21,39 @@ 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); + }, + getCookieValue(cookieName) { + return document.cookie + ?.split("; ") + ?.find(row => row.startsWith(`${cookieName}=`)) + ?.split("=")[1]; + }, + setCookieValue(cookieName, cookieValue) { + document.cookie = `${cookieName}=${cookieValue}`; + }, + deleteCookie(cookieName) { + document.cookie = `${cookieName}=; Max-Age=0; path=/; domain=${location.hostname}`; + }, + navigateToHeritageFunnel() { + var referralCorrelationId = store.getters.referralCorrelationId; + + router.navigate( + navigationScenarios.MOVE_TO_HERITAGE_FUNNEL, + router.currentRoute.value, + { + corid: referralCorrelationId, + src: "concept-funnel", + // TODO CSR-98 REMOVE THIS + cns: "all", + experiments: "ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true" + } + ); } }, computed: { diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index da684af1b..e1599a319 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -79,6 +79,8 @@ describe("baseMixin.js", () => { }); }); + + function getMixInInstance({ isDispatchSuccess = true }) { // Mock Store const storeDispatch = jest.fn(); diff --git a/src/router/index.js b/src/router/index.js index 3d182ba37..c0ce384b1 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -8,6 +8,7 @@ import { routerParameterKeys } from '@/router/router-constants/router-parameter- import baseMixin from "@/mixins/base-mixin"; import eventBus from "@/helpers/event-bus/event-bus"; import store from "@/store"; +import { cookieNames } from "@/constants/cookie-names"; // Components import ComponentTest from "@/layouts/component-test/component-test.vue"; @@ -51,6 +52,12 @@ const routes = [ path: "/", name: "root", async beforeEnter(to, from, next) { + // TODO CSR-98 Also triggers on refresh... should it though? + // Entering the concept funnel + if (from.redirectedFrom === undefined) { + handleInfoFromHeritageFunnel(); + } + // If we have no query string, or we don't have the FmgPage query string. if (to.query.fmgPage === undefined) { await GoToFunnelStartOn404(next); @@ -58,7 +65,6 @@ const routes = [ try { // If we already have our route, go to it. if (router.hasRoute(to.query.fmgPage)) { - // Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function. let component = router.getRoutes().filter((x) => x.name === to.query.fmgPage)[0].components; @@ -133,10 +139,14 @@ 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); + const destinationFmgPageValue = matchingScenarioMap.destinationFmgPageValue; - if (matchingScenarioMap.destinationFmgPageValue !== undefined) { + if (destinationFmgPageValue !== undefined) { // We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one. // If we need to do invalidation @@ -147,17 +157,23 @@ 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); + baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData); + + baseMixin.methods.saveOrder(); router.push({ name: "root", query: Object.assign(optionalQuery, { - fmgPage: matchingScenarioMap.destinationFmgPageValue, + fmgPage: destinationFmgPageValue, }), params: Object.assign(optionalParams, {[routerParameterKeys.FROM_ROUTER_NAVIGATE]: true}) }); } else if (matchingScenarioMap.destinationUrl !== undefined) { - navigateToUrl(matchingScenarioMap.destinationUrl); + if (matchingScenarioMap.shouldNavigateToHeritageFunnel) { + baseMixin.methods.saveOrder(); + } + + navigateToUrl(matchingScenarioMap.destinationUrl, optionalQuery); } } @@ -178,9 +194,15 @@ 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. @@ -237,4 +259,20 @@ function resetDependentState(component) { return component.default.methods.resetDependentState(); } +// Read info from heritage funnel and reset state or load referral +function handleInfoFromHeritageFunnel() { + var orderInfoJson = baseMixin.methods.getCookieValue(cookieNames.ORDER_INFO); + var orderInfo = orderInfoJson == null ? null : JSON.parse(orderInfoJson); + + if (orderInfo?.ShouldResetState) { + store.dispatch(storeActions.RESET_STATE); + } + else if (orderInfo != null) { + // should load referral here + } + + // Delete cookie once state is loaded or reset + baseMixin.methods.deleteCookie(cookieNames.ORDER_INFO); +} + export default router; \ No newline at end of file diff --git a/src/router/router-constants/externalUrl-values.js b/src/router/router-constants/externalUrl-values.js new file mode 100644 index 000000000..7e9931f6e --- /dev/null +++ b/src/router/router-constants/externalUrl-values.js @@ -0,0 +1,5 @@ +const externalUrls = { + HERITAGE_FUNNEL: process.env.VUE_APP_HERITAGE_FUNNEL, +}; + +export { externalUrls }; \ No newline at end of file diff --git a/src/router/router-constants/fmgPage-values.js b/src/router/router-constants/fmgPage-values.js index 770c1f7b6..b648ae047 100644 --- a/src/router/router-constants/fmgPage-values.js +++ b/src/router/router-constants/fmgPage-values.js @@ -4,9 +4,10 @@ const fmgPageValues = { VEHICLE_MODEL: "vehicle-model", VEHICLE_STYLE: "vehicle-style", VEHICLE_DAMAGE: "vehicle-damage", + VIN_LOOKUP: "vin-lookup", VEHICLE_PARTS: "vehicle-parts", PART_QUESTIONS: "part-questions", REVEAL : "reveal", }; -export { fmgPageValues }; \ No newline at end of file +export { fmgPageValues }; diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index 9fd1c6311..972944d80 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -4,10 +4,12 @@ const navigationScenarios = { SELECTED_MAKE: "SELECTED_MAKE", SELECTED_STYLE: "SELECTED_STYLE", CLICKED_BACK: "CLICKED_BACK", + CLICKED_FORWARD: "CLICKED_FORWARD", SELECTED_PARTS: "SELECTED_PARTS", SELECTED_DAMAGE_WITH_SINGLE_PART: "SELECTED_DAMAGE_WITH_SINGLE_PART", SELECTED_DAMAGE_WITH_MULTIPLE_PARTS: "SELECTED_DAMAGE_WITH_MULTIPLE_PARTS", - SELECTED_DAMAGE_WITH_PART_QUESTIONS: "SELECTED_DAMAGE_WITH_PART_QUESTIONS" + SELECTED_DAMAGE_WITH_PART_QUESTIONS: "SELECTED_DAMAGE_WITH_PART_QUESTIONS", + MOVE_TO_HERITAGE_FUNNEL: "MOVE_TO_HERITAGE_FUNNEL", }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index c9dc7ba4d..8fc8ad013 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -1,4 +1,5 @@ import { fmgPageValues } from "@/router/router-constants/fmgPage-values"; +import { externalUrls } from "@/router/router-constants/externalUrl-values"; import { navigationScenarios } from "@/router/router-constants/navigation-scenarios"; const routingTable = [ @@ -57,9 +58,14 @@ const routingTable = [ scenario: navigationScenarios.CLICKED_BACK, destinationFmgPageValue: fmgPageValues.VEHICLE_STYLE, }, + { + scenario: navigationScenarios.MOVE_TO_HERITAGE_FUNNEL, + destinationUrl: externalUrls.HERITAGE_FUNNEL, + shouldNavigateToHeritageFunnel: true + }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, - destinationFmgPageValue: fmgPageValues.REVEAL, + destinationFmgPageValue: fmgPageValues.REVEAL }, { scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, @@ -80,10 +86,27 @@ const routingTable = [ }, { scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.QUOTE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD, destinationFmgPageValue: fmgPageValues.REVEAL, }, ], }, + { + fmgPageValue: fmgPageValues.REVEAL, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.SELECTED_PARTS, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, + }, + ], + }, ]; export { routingTable }; diff --git a/src/store/index.js b/src/store/index.js index a00f550be..f453aa340 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,34 +7,41 @@ import globalMethods from "@/global-methods"; // Export State -export const state = { - order: { - vehicle: { - year: null, - make: null, - model: null, - style: null, - carId: null, - category: null, - imageUrl: null, - imageVifNumber: null, - imageColor: null, +const getDefaultState = () => { + return { + order: { + vehicle: { + year: null, + make: null, + model: null, + style: null, + carId: null, + category: null, + imageUrl: null, + imageVifNumber: null, + imageColor: null, + }, + damage: { + isRepair: null, + numberOfChips: null, + glassToReplace: null, + }, + lineItems:{ + glassParts: null, + otherParts: null + }, + referralNumber: null, + referralDate: null, + referralCorrelationId: null, }, - damage: { - isRepair: null, - numberOfChips: null, - glassToReplace: null, + applicationUser: { + eventBus: [], + pageData: {} }, - lineItems:{ - glassParts: {}, - otherParts: {} - } - }, - applicationUser: { - eventBus: [], - pageData: {} - }, -} + } +}; + +export const state = getDefaultState(); // Export Mutations export const mutations = { @@ -81,6 +88,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) { @@ -120,6 +136,9 @@ export const mutations = { resetPartsState(state) { state.order.lineItems.glassParts = null; state.order.lineItems.otherParts = null; + }, + resetState(state) { + Object.assign(state, getDefaultState()); } } @@ -137,6 +156,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]; } @@ -230,6 +252,9 @@ export const actions = { resetPartsAndDependencies(context) { context.commit(storeMutations.RESET_PARTS_STATE); }, + resetState(context) { + context.commit(storeMutations.RESET_STATE); + }, // Content API Actions getRouteInfo(context, { pageName }) { @@ -274,7 +299,31 @@ export const actions = { vin: vin }, }); - } + }, + + // Order API Actions + saveOrder(context) { + const vehicle = context.getters.vehicle; + const damage = context.getters.damage; + + return globalMethods.callHttpClient({ + method: endpoints.SaveOrder.method, + endpoint: endpoints.SaveOrder.url, + payload: { + vehicle: { + carId: vehicle.carId, + year: vehicle.year, + make: vehicle.make, + model: vehicle.model, + style: vehicle.style, + }, + numberOfChips: damage.numberOfChips, + glassToReplace: damage.glassToReplace, + referralNumber: context.getters.referralNumber, + referralDate: context.getters.referralDate + }, + }); + }, } export default createStore({ diff --git a/src/styles/common-styles.scss b/src/styles/common-styles.scss index 561b05b76..8425a3021 100644 --- a/src/styles/common-styles.scss +++ b/src/styles/common-styles.scss @@ -35,4 +35,3 @@ body { overflow: hidden; } } -// Hide horizontal scrollbar diff --git a/vue.config.js b/vue.config.js index 316656ed1..704ca0907 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,7 @@ process.env.VUE_APP_CONSUMER_API_GATEWAY = "https://consumerapidev.safelite.com"; +process.env.VUE_APP_HERITAGE_FUNNEL = + "http://localhost:38000/default.aspx"; module.exports = { outputDir: "dist/fmg", @@ -19,4 +21,7 @@ module.exports = { }, }, }, + configureWebpack: { + devtool: 'source-map' + }, }; diff --git a/vue.release.config.js b/vue.release.config.js index 43fffb47f..3c281dc78 100644 --- a/vue.release.config.js +++ b/vue.release.config.js @@ -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",