{
zipCode: null,
zipCodeCtu: null,
appointmentType: null,
+ provider: {
+ providerNumber: null,
+ address: {
+ streetAddress: null,
+ city: null,
+ state: null,
+ zip: null,
+ },
+ },
},
customer: {
emailAddress: null,
@@ -70,6 +79,12 @@ const getDefaultState = () => {
},
parentAccountNumber: 0,
},
+ schedule: {
+ date: null,
+ startTime: null,
+ endTime: null,
+ routeCode: null,
+ },
referralNumber: null,
referralDate: null,
referralCorrelationId: null,
@@ -226,10 +241,34 @@ export const mutations = {
},
updateServiceLocation(state, serviceLocationInfo) {
state.order.serviceLocation.address = serviceLocationInfo.address;
+ state.order.serviceLocation.address2 = serviceLocationInfo.address2;
state.order.serviceLocation.city = serviceLocationInfo.city;
state.order.serviceLocation.state = serviceLocationInfo.state;
state.order.serviceLocation.zipCode = serviceLocationInfo.zipCode;
state.order.serviceLocation.zipCodeCtu = serviceLocationInfo.zipCodeCtu;
+ state.order.serviceLocation.appointmentType = serviceLocationInfo.appointmentType;
+ state.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected;
+
+ if (serviceLocationInfo.provider) {
+ state.order.serviceLocation.provider.providerNumber =
+ serviceLocationInfo.provider?.providerNumber;
+ state.order.serviceLocation.provider.address.streetAddress =
+ serviceLocationInfo.provider?.address?.streetAddress;
+ state.order.serviceLocation.provider.address.city =
+ serviceLocationInfo.provider?.address?.city;
+ state.order.serviceLocation.provider.address.state =
+ serviceLocationInfo.provider?.address?.state;
+ state.order.serviceLocation.provider.address.zip =
+ serviceLocationInfo.provider?.address?.zip;
+ }
+ },
+ updateSchedule(state, scheduleInfo) {
+ if (scheduleInfo) {
+ state.order.schedule.date = scheduleInfo.date;
+ state.order.schedule.startTime = scheduleInfo.startTime;
+ state.order.schedule.endTime = scheduleInfo.endTime;
+ state.order.schedule.routeCode = scheduleInfo.routeCode;
+ }
},
// applicationUser MUTATIONS
@@ -358,15 +397,31 @@ export const mutations = {
state.order.lineItems.serverData = sessionInformation.order.lineItems.serverData;
state.order.payment.parentAccountNumber =
sessionInformation.order.payment.parentAccountNumber;
- state.order.providerNumber = sessionInformation.order.providerNumber;
(state.order.serviceLocation.address =
sessionInformation.order.serviceLocation.streetAddress),
+ (state.order.serviceLocation.address2 =
+ sessionInformation.order.serviceLocation.address2),
(state.order.serviceLocation.city = sessionInformation.order.serviceLocation.city),
(state.order.serviceLocation.state = sessionInformation.order.serviceLocation.state),
(state.order.serviceLocation.zipCode =
sessionInformation.order.serviceLocation.zipCode),
(state.order.serviceLocation.zipCodeCtu =
sessionInformation.order.serviceLocation.zipCodeCtu);
+ state.order.serviceLocation.appointmentType =
+ sessionInformation.order.serviceLocation.appointmentType;
+ state.order.serviceLocation.isVehicleProtected =
+ sessionInformation.order.serviceLocation.isVehicleProtected;
+
+ state.order.serviceLocation.provider.providerNumber =
+ sessionInformation.order.serviceLocation.provider?.providerNumber;
+ state.order.serviceLocation.provider.address.streetAddress =
+ sessionInformation.order.serviceLocation.provider?.address?.streetAddress;
+ state.order.serviceLocation.provider.address.city =
+ sessionInformation.order.serviceLocation.provider?.address?.city;
+ state.order.serviceLocation.provider.address.state =
+ sessionInformation.order.serviceLocation.provider?.address?.state;
+ state.order.serviceLocation.provider.address.zip =
+ sessionInformation.order.serviceLocation.provider?.address?.zip;
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
state.order.payment.insuranceCoverage.isVerified =
@@ -380,6 +435,11 @@ export const mutations = {
state.applicationUser.crmCustomerId = sessionInformation.applicationUser.crmCustomerId;
state.applicationUser.pageData = sessionInformation.applicationUser.pageData;
state.applicationUser.lastPage = sessionInformation.applicationUser.lastPage;
+
+ state.order.schedule.date = sessionInformation.order.schedule?.date;
+ state.order.schedule.startTime = sessionInformation.order.schedule?.startTime;
+ state.order.schedule.endTime = sessionInformation.order.schedule?.endTime;
+ state.order.schedule.routeCode = sessionInformation.order.schedule?.routeCode;
},
updateExperiments(state, experiments) {
state.applicationUser.experiments = experiments;
@@ -681,6 +741,15 @@ export const actions = {
});
},
+ // Location API Actions
+ getAlertReasonsByCtu(context, { ctu }) {
+ return globalMethods.callHttpClient({
+ method: endpoints.GetAlertReasons.method,
+ endpoint: `${endpoints.GetAlertReasons.url}/${ctu}`,
+ payload: {},
+ });
+ },
+
// Misc Actions
updateStoreWithSaveSessionResponse(
context,
@@ -727,12 +796,21 @@ export const actions = {
experimentsForUser: experimentsForUser,
};
- return globalMethods.callHttpClient({
- method: endpoints.LogPageView.method,
- endpoint: endpoints.LogPageView.url,
- payload: payload,
- logApiCall: false,
- });
+ return globalMethods
+ .callHttpClient({
+ method: endpoints.LogPageView.method,
+ endpoint: endpoints.LogPageView.url,
+ payload: payload,
+ logApiCall: false,
+ })
+ .then(
+ (response) => {
+ return response;
+ },
+ (error) => {
+ console.log("Analytics Service Error: " + error.data);
+ }
+ );
},
logCustomEvent(
context,
@@ -763,12 +841,21 @@ export const actions = {
experimentsForUser: experimentsForUser,
};
- return globalMethods.callHttpClient({
- method: endpoints.LogCustomEvent.method,
- endpoint: endpoints.LogCustomEvent.url,
- payload: payload,
- logApiCall: false,
- });
+ return globalMethods
+ .callHttpClient({
+ method: endpoints.LogCustomEvent.method,
+ endpoint: endpoints.LogCustomEvent.url,
+ payload: payload,
+ logApiCall: false,
+ })
+ .then(
+ (response) => {
+ return response;
+ },
+ (error) => {
+ console.log("Analytics Service Error: " + error.data);
+ }
+ );
},
initializeSession(context, { userId, sessionId, userAgent, referrer }) {
var payload = {
@@ -782,12 +869,21 @@ export const actions = {
referrer: referrer,
};
- return globalMethods.callHttpClient({
- method: endpoints.InitializeSession.method,
- endpoint: endpoints.InitializeSession.url,
- payload: payload,
- logApiCall: false,
- });
+ return globalMethods
+ .callHttpClient({
+ method: endpoints.InitializeSession.method,
+ endpoint: endpoints.InitializeSession.url,
+ payload: payload,
+ logApiCall: false,
+ })
+ .then(
+ (response) => {
+ return response;
+ },
+ (error) => {
+ console.log("Analytics Service Error: " + error.data);
+ }
+ );
},
// Misc Actions
@@ -927,13 +1023,13 @@ export const actions = {
},
getMobileFeePart(context) {
- const serviceType = context.getters.damage.isRepair ? "Repair" : "Replace";
+ const damageType = context.getters.damage.isRepair ? "Repair" : "Replace";
const parentAccountNumber = context.getters.payment.parentAccountNumber;
const billToAccountNumber = 87291; // TODO: MAKE THIS REAL
return globalMethods.callHttpClient({
method: endpoints.GetMobileFeePart.method,
- endpoint: `${endpoints.GetMobileFeePart.url}/${serviceType}/${parentAccountNumber}/${billToAccountNumber}`,
+ endpoint: `${endpoints.GetMobileFeePart.url}/${damageType}/${parentAccountNumber}/${billToAccountNumber}`,
});
},
@@ -943,13 +1039,34 @@ export const actions = {
partNumber: lineItem.partNumber,
})
);
- const lineItemsToSend = buildQueryStringParameterFromArrayOfComplexObjects(
+ const lineItems = buildQueryStringParameterFromArrayOfComplexObjects(
lineItemsWithOnlyPartNumbers,
"lineItems"
);
+
+ const vehicle = context.getters.vehicle;
+ const carId = vehicle.carId;
+ const damage = context.getters.damage;
+ const glassArray = convertGlassPieceNamingForApi(damage.glassToReplace);
+
+ const glassPieces = buildQueryStringParameterFromArrayOfComplexObjects(
+ glassArray,
+ "glassPieces"
+ );
+
return globalMethods.callHttpClient({
method: endpoints.GetServiceabilityDetails.method,
- endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&${lineItemsToSend}`,
+ endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&carId=${carId}&${lineItems}&${glassPieces}`,
+ });
+ },
+
+ getProviders(context, { serviceZipCode }) {
+ const damageType = context.getters.damage.isRepair ? "Repair" : "Replace";
+ const shopRadiusInMiles = 100;
+
+ return globalMethods.callHttpClient({
+ method: endpoints.GetProviders.method,
+ endpoint: `${endpoints.GetProviders.url}/${serviceZipCode}/${damageType}/${shopRadiusInMiles}`,
});
},
@@ -964,7 +1081,7 @@ export const actions = {
endpoint: endpoints.GetSupportingItems.url,
payload: {
carId: carId,
- serviceType: isRepair ? "Repair" : "Replace",
+ damageType: isRepair ? "Repair" : "Replace",
parentAccountNumber: applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
parts: glassPartsArray,
numberOfRepairChips: isRepair ? numberOfChips : 0,
@@ -1098,13 +1215,31 @@ export const actions = {
isInsurance: order.payment.isInsurance ?? false,
parentAccountNumber: order.payment.parentAccountNumber,
},
- providerNumber: "",
serviceLocation: {
streetAddress: order.serviceLocation.address,
+ streetAddress2: order.serviceLocation.address2,
city: order.serviceLocation.city,
state: order.serviceLocation.state,
zipCode: order.serviceLocation.zipCode,
zipCodeCtu: order.serviceLocation.zipCodeCtu,
+ appointmentType: order.serviceLocation.appointmentType,
+ isVehicleProtected: order.serviceLocation.isVehicleProtected,
+ provider: {
+ providerNumber: order.serviceLocation.provider?.providerNumber,
+ address: {
+ streetAddress:
+ order.serviceLocation.provider?.address?.streetAddress,
+ city: order.serviceLocation.provider?.address?.city,
+ state: order.serviceLocation.provider?.address?.state,
+ zip: order.serviceLocation.provider?.address?.zip,
+ },
+ },
+ },
+ schedule: {
+ date: order.schedule?.date,
+ startTime: order.schedule?.startTime,
+ endTime: order.schedule?.endTime,
+ routeCode: order.schedule?.routeCode,
},
existingPromoCode: null,
referralCorrelationId: order.referralCorrelationId,
@@ -1549,6 +1684,9 @@ export const actions = {
return availableLineItems;
},
// Misc order actions
+ saveSchedule(context, scheduleInfo) {
+ context.commit(storeMutations.UPDATE_SCHEDULE, scheduleInfo);
+ },
saveServiceLocation(context, serviceLocationInfo) {
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo);
},