CSR-416 WIP

This commit is contained in:
Katie 2022-05-02 17:19:22 -04:00
parent a16416be69
commit 219fb3a731
8 changed files with 62 additions and 22 deletions

View file

@ -5,7 +5,13 @@ import httpStatusCodes from "http-status-codes";
export default {
callHttpClient({ method, endpoint, payload }) {
return new Promise((resolve, reject) => {
const apiGatewayUrl = applicationConfig.CONSUMER_APIGATEWAY_URL;
let 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",

View file

@ -12,7 +12,7 @@ import router from "@/router";
the user has an existing order and they come back in from the Safelite.com CTA.
*/
export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHeritageOrder = false) {
console.log("B")
// If the user is coming in via the Safelite.Com CTA
if (toRoute.query[queryStrings.START_TYPE] === 'fmg') {
// If they have an existing order, return 'heritage' for the page name.
@ -40,7 +40,7 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita
Used to navigate to the heritage funnel with the correct query string and url.
*/
export async function navigateToHeritageFunnel() {
export async function navigateToHeritageFunnel(suppressConceptFunnel = false) {
// Create the order (or save existing order) when navigating to Heritage Funnel.
await saveOrder();
@ -49,6 +49,7 @@ export async function navigateToHeritageFunnel() {
{
corid: store.getters.order.referralCorrelationId,
src: "concept-funnel",
suppressConceptFunnel: suppressConceptFunnel
}
);
}

View file

@ -77,7 +77,7 @@ import { required } from "@/helpers/validation-rules";
import { errorMessages } from "@/constants/error-messages";
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
// import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
import store from "@/store";
import baseMixin from "@/mixins/base-mixin";
@ -279,14 +279,6 @@ export default {
},
navigateForward(partsData){
// Temporary easter egg to navigate to heritage funnel.
const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ];
if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) {
navigateToHeritageFunnel();
return;
}
// If vin already exists, navigate directly to vin-lookup
if(this.$store.getters.vehicle.vin){
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route);

View file

@ -43,6 +43,8 @@ export default {
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const yearQuestionInitialDataPromise = yearQuestion.methods.loadInitialData();
console.log("A")
// Log experiment exposure
const logExperimentExposurePromise = baseMixin.methods.dispatchNonBlockingStoreAction(storeActions.LOG_EXPERIMENT_EXPOSURE,
{

View file

@ -116,6 +116,7 @@ import { storeMutations } from "@/constants/store-mutations";
import { errorMessages } from "@/constants/error-messages";
import { required, regex } from "@/helpers/validation-rules";
import { Form, defineRule } from "vee-validate";
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
// DEFINE VALIDATION RULES
defineRule("zip-required", required(errorMessages.ZIP_REQUIRED));
@ -127,6 +128,7 @@ defineRule("vin-format", regex(/^[A-HJ-NPR-Z0-9]{17}$/, errorMessages.VIN_FORMAT
export default {
name: "vin-lookup",
async beforeRouteEnter(to, from, next) {
console.log("C")
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
@ -180,19 +182,23 @@ export default {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
},
async forwardButtonAction() {
console.log("1")
const zipValidation = await this.validateZip(this.zip);
if (!zipValidation.data.isServiceable) {
console.log("2")
this.customAlertData.zip = this.zip;
this.$refs.funnelFooter.removeLoader();
this.noServiceZip = true;
return;
}
const vinLookup = await this.lookupVin(this.vin).catch(() => {
console.log("3")
this.$refs.funnelFooter.removeLoader();
this.noMatchAlert = true;
return;
});
if (vinLookup.data.carId !== store.getters.vehicle.carId) {
console.log("4")
this.customAlertData.vehicleInfo = vinLookup.data.vehicle;
this.$refs.funnelFooter.removeLoader();
this.foundWindshieldAlert = true;
@ -213,6 +219,14 @@ export default {
this.navigateForward(partsData);
},
navigateForward(partsData){
console.log("5")
// Temporary easter egg to navigate to heritage funnel.
const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ];
if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) {
navigateToHeritageFunnel();
return;
}
if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data);
return;

View file

@ -212,6 +212,9 @@ function navigateToUrl(url, optionalQuery = {}) {
/////////////////////////////////////////////////////
if (externalUrl.search.indexOf("corid=") != -1)
externalUrl.search = externalUrl.search + '&experiments=CollectEmailOnQuote=CollectEmailOnQuote_V1=YesCollectEmail_TEST1=true,RemoveServiceAreaPage=ServAreaRemoval_V7=ServAreaNoRemove_V7_TEST=true,VINeducationV2=VINeducation_V2=NoShowVINmodalV2_CONTROL=true,ServicePackages=ServicePackages_V1=NoShowPackages_CONTROL=true,PhotoUploadRedesign=PhotoUploadRedesign_V1=CurrentPhotoUpload_CONTROL=true,ScheduleDetailsServiceType=ScheduleBeforeServiceType_V1=ServTypeThenSched_CONTROL=true';
// TODO REMOVE
externalUrl.search += ",ConceptFunnel=ConceptFunnel_V1=ConceptFunnel_TEST=true"
///////////// END TEMP CODE /////////////////////////
window.location.assign(externalUrl);

View file

@ -59,7 +59,8 @@ const routingTable = [
},
{
scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN,
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
// destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
},
{
scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART,

View file

@ -15,7 +15,7 @@ const getDefaultState = () => {
model: null,
style: null,
carId: null,
category: null,
category: null,
vin: null,
imageUrl: null,
imageVifNumber: null,
@ -200,6 +200,7 @@ export const mutations = {
// Misc Mutations
updateStateWithOrderInformation(state, orderInformation) {
console.log(orderInformation)
state.order.referralNumber = orderInformation.referralNumber;
state.order.referralDate = orderInformation.referralDate;
state.order.referralCorrelationId = orderInformation.referralCorrelationId;
@ -215,6 +216,9 @@ export const mutations = {
imageUrl: orderInformation.vehicle?.imageUrl,
imageVifNumber: orderInformation.vehicle?.imageVifNumber,
imageColor: orderInformation.vehicle?.imageVifColor,
registration: {
zipCode: orderInformation.zipCode // TODO CSR-416 make sure customer vs service is different
}
});
state.order.damage.glassToReplace = orderInformation.glassToReplace;
@ -223,10 +227,12 @@ export const mutations = {
state.order.lineItems.glassParts = orderInformation.parts;
state.order.accountNumber = orderInformation.accountNumber;
state.order.serviceLocation.zipCode = orderInformation.zipCode;
state.order.serviceLocation.zip = orderInformation.zipCode; // TODO CSR-416 make sure customer vs service is different
state.order.payment.isInsurance = orderInformation.IsInsuranceOrder;
state.order.payment.insuranceCoverage.isVerified = orderInformation?.insuranceInfo.coverageVerified;
state.order.customer.emailAddress = orderInformation.emailAddress
}
}
@ -463,6 +469,7 @@ export const actions = {
saveOrder(context) {
const vehicle = context.getters.vehicle;
const damage = context.getters.damage;
const order = context.state.order;
return globalMethods.callHttpClient({
method: endpoints.SaveOrder.method,
@ -474,14 +481,28 @@ export const actions = {
make: vehicle.make,
model: vehicle.model,
style: vehicle.style,
vin: vehicle.vin
vin: vehicle.vin,
registration: {
firstName: vehicle.registration.firstName,
lastName: vehicle.registration.lastName,
licensePlate: vehicle.registration.licensePlate,
zipCode: vehicle.registration.zipCode
},
},
numberOfChips: damage.numberOfChips,
zipCode: 43215, // TODO CSR-416, should not be hardcoded (state.order.serviceLocation.zipCode)
glassToReplace: damage.glassToReplace,
referralNumber: context.state.order.referralNumber,
referralDate: context.state.order.referralDate,
accountNumber: context.state.order.accountNumber
damage: {
numberOfChips: damage.numberOfChips,
glassToReplace: damage.glassToReplace,
isRepair: damage.isRepair
},
customer: {
emailAddress: order.customer.emailAddress,
},
serviceLocation: {
zipCode: order.serviceLocation.zip
},
referralNumber: order.referralNumber,
referralDate: order.referralDate,
accountNumber: order.accountNumber
},
});
},