everything is converted over but it needs tested now

This commit is contained in:
Jason Wheeler 2023-01-11 16:01:31 -05:00
parent c3d164cc2c
commit b0bef5b5e2
5 changed files with 73 additions and 18 deletions

View file

@ -63,6 +63,10 @@ const endpoints = {
url: "/vehicle/api/v1/vehicle/lookup", url: "/vehicle/api/v1/vehicle/lookup",
method: "POST", method: "POST",
}, },
LookupVinByAddress: {
url: "/vehicle/api/v1/vehicle/lookup-vin-by-address",
method: "POST",
},
InitializeSession: { InitializeSession: {
url: "/analytics/api/v1/analytics/initialize", url: "/analytics/api/v1/analytics/initialize",
method: "POST", method: "POST",
@ -79,6 +83,9 @@ const endpoints = {
url: "/location/api/v1/location/zip", url: "/location/api/v1/location/zip",
method: "GET", method: "GET",
}, },
GooglePlaces: {
url: "https://maps.googleapis.com/maps/api/js?key={apiKey}&libraries=places"
}
}; };
export { endpoints }; export { endpoints };

View file

@ -193,6 +193,7 @@ export default {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
attachCustomEvents() { attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => { this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA( this.pushEventToGA(
this.$route.query[this.queryStrings.ISS_PAGE], this.$route.query[this.queryStrings.ISS_PAGE],
@ -201,6 +202,7 @@ export default {
true true
); );
}); });
}, },
async forwardButtonAction() { async forwardButtonAction() {
@ -209,19 +211,13 @@ export default {
// Vehicle info change in the flow, use a variable to keep track and commit to state at the end. // Vehicle info change in the flow, use a variable to keep track and commit to state at the end.
let vehicleInfoToCommit = {}; let vehicleInfoToCommit = {};
//Todo: Look up VIN by address const vinLookupResponse = useMainStore().lookupVinByAddress ({
/*
const vinLookupResponse = this.dispatchStoreAction(
storeActions.LOOKUP_VIN_BY_ADDRESS,
{
licenseLastName: this.customerQuestions.lastName, licenseLastName: this.customerQuestions.lastName,
licenseStreetAddress: this.customerQuestions.addressQuestions.streetAddress, licenseStreetAddress: this.customerQuestions.addressQuestions.streetAddress,
licenseZip: this.customerQuestions.addressQuestions.zipCode, licenseZip: this.customerQuestions.addressQuestions.zipCode,
licenseState: this.customerQuestions.addressQuestions.state, licenseState: this.customerQuestions.addressQuestions.state,
}, }
false
); );
*/
// Settle promises and get results // Settle promises and get results
const promiseResultMap = [ const promiseResultMap = [
@ -260,7 +256,7 @@ export default {
// Single VIN found // Single VIN found
const carFound = carsFound[0].vehicle; const carFound = carsFound[0].vehicle;
this.isCarIdDifferent = carFound.carId !== this.mainStore.order.vehicle.carId; this.isCarIdDifferent = carFound.carId !== useMainStore().order.vehicle.carId;
if (this.isCarIdDifferent && carFound.carId !== this.previouslyEnteredCarId) { if (this.isCarIdDifferent && carFound.carId !== this.previouslyEnteredCarId) {
// Display Alert // Display Alert
this.previouslyEnteredCarId = carFound.carId; this.previouslyEnteredCarId = carFound.carId;
@ -348,7 +344,7 @@ export default {
async navigateForward(carsFound) { async navigateForward(carsFound) {
// Match vehicles found to vehicles in state. // Match vehicles found to vehicles in state.
const matchingCars = carsFound.filter( const matchingCars = carsFound.filter(
(car) => car.vehicle.carId === this.mainStore.order.vehicle.carId (car) => car.vehicle.carId === useMainStore().order.vehicle.carId
); );
// If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage" // If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage"
@ -358,7 +354,7 @@ export default {
!this.isSelectedGlassAvailableForVehicle && !this.isSelectedGlassAvailableForVehicle &&
matchingCars.length === 1 matchingCars.length === 1
) { ) {
this.$router.navigateWithSaving( this.$router.navigate(
this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
this.$route, this.$route,
{}, {},
@ -367,7 +363,7 @@ export default {
} else if (matchingCars.length === 1) { } else if (matchingCars.length === 1) {
await this.navigateForwardWithSingleCarMatch(); await this.navigateForwardWithSingleCarMatch();
} else { } else {
this.$router.navigateWithSaving( this.$router.navigate(
this.navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES, this.navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES,
this.$route, this.$route,
{}, {},

View file

@ -78,7 +78,8 @@ import { applicationConfig } from "@/constants/application-config.js";
import { defineRule } from "vee-validate"; import { defineRule } from "vee-validate";
import { required, regex } from "@/helpers/validation-rules"; import { required, regex } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages"; import { errorMessages } from "@/constants/error-messages";
import { states } from "@/constants/states" import { states } from "@/constants/states";
import { endpoints } from '@/constants/endpoints';
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule("street-address-required", required(errorMessages.STREET_ADDRESS_REQUIRED)); defineRule("street-address-required", required(errorMessages.STREET_ADDRESS_REQUIRED));
@ -147,10 +148,10 @@ export default {
const addressField1 = document.getElementById("autocomplete"); const addressField1 = document.getElementById("autocomplete");
const self = this; const self = this;
const apiKey = applicationConfig.GOOGLE_PLACES_API_KEY; const url = endpoints.GooglePlaces.url.replace("{apiKey}", applicationConfig.GOOGLE_PLACES_API_KEY)
this.$loadScript( this.$loadScript(
`https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places` url
) )
.then(() => { .then(() => {
// Script is loaded, initialize the autocomplete textbox // Script is loaded, initialize the autocomplete textbox

View file

@ -222,7 +222,44 @@ const routingTable = function(store) {
destinationIssPageValue: issPageValues.QUOTE, destinationIssPageValue: issPageValues.QUOTE,
}, },
], ],
}, },
{
issPageValue: issPageValues.ADDRESS_LOOKUP,
maps: [
{
scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES,
destinationIssPageValue: issPageValues.ADDRESS_VEHICLES,
},
{
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS,
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.QUOTE,
},
],
},
{ {
issPageValue: issPageValues.WELCOME_PAGE, issPageValue: issPageValues.WELCOME_PAGE,
maps: [ maps: [

View file

@ -172,7 +172,21 @@ export const useMainStore = defineStore({
}, },
actions: actions:
{ {
// Content API Actions // Content API Actions
lookupVinByAddress({ licenseLastName, licenseStreetAddress, licenseZip, licenseState }) {
return globalMethods.callHttpClient({
method: endpoints.LookupVinByAddress.method,
endpoint: endpoints.LookupVinByAddress.url,
payload: {
licenseLastName: licenseLastName,
licenseStreetAddress: licenseStreetAddress,
licenseZip: licenseZip,
licenseState: licenseState,
},
});
},
getRouteInfo(pageName) { getRouteInfo(pageName) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetRouteInfo.method, method: endpoints.GetRouteInfo.method,