Merge branch 'develop' into CSR-101-code-review-updates
This commit is contained in:
commit
e4f2fa9ea5
26 changed files with 619 additions and 549 deletions
|
|
@ -79,6 +79,7 @@ stages:
|
||||||
__VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__)
|
__VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__)
|
||||||
__VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__)
|
__VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__)
|
||||||
__VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__)
|
__VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__)
|
||||||
|
__VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__)
|
||||||
indexDeployVariables:
|
indexDeployVariables:
|
||||||
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
|
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
|
||||||
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
|
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
|
||||||
|
|
@ -119,4 +120,8 @@ stages:
|
||||||
__VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__)
|
__VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__)
|
||||||
__VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__)
|
__VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__)
|
||||||
__VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__)
|
__VUE_APP_HERITAGE_FUNNEL__: $(__VUE_APP_HERITAGE_FUNNEL__)
|
||||||
|
__VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__)
|
||||||
|
indexDeployVariables:
|
||||||
|
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
|
||||||
|
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
|
||||||
cfDistributionId: $(cfDistributionId)
|
cfDistributionId: $(cfDistributionId)
|
||||||
|
|
@ -4,7 +4,8 @@ const applicationConfig = {
|
||||||
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
|
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
|
||||||
ANALYTICS_SESSION_TIMEOUT_MINUTES: 30,
|
ANALYTICS_SESSION_TIMEOUT_MINUTES: 30,
|
||||||
SAVED_SESSION_TIMEOUT_DAYS: 45,
|
SAVED_SESSION_TIMEOUT_DAYS: 45,
|
||||||
COOKIE_PATH: "/"
|
COOKIE_PATH: "/",
|
||||||
|
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT // "Localhost", "Dev", "QA", and "Prod"
|
||||||
};
|
};
|
||||||
|
|
||||||
export { applicationConfig };
|
export { applicationConfig };
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
|
import { applicationConfig } from "@/constants/application-config.js"
|
||||||
|
|
||||||
const cookieNames = {
|
const cookieNames = {
|
||||||
FUNNEL_SESSION_INFO: "FunnelSessionInfo",
|
FUNNEL_SESSION_INFO: `FunnelSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,
|
||||||
|
|
||||||
// Existing Safelite.com cookies
|
// Existing Safelite.com cookies
|
||||||
DXDEV: "dxdev",
|
DXDEV: "dxdev",
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,16 @@ const endpoints = {
|
||||||
url: "/analytics/api/v1/analytics/log-experiment-exposure",
|
url: "/analytics/api/v1/analytics/log-experiment-exposure",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
LogActivity:{
|
LogPageView:{
|
||||||
url: "/analytics/api/v1/analytics/activity",
|
url: "/analytics/api/v1/analytics/log-page-view",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
},
|
},
|
||||||
GetExperimentsByUserForGa: {
|
LogCustomEvent:{
|
||||||
url: "/analytics/api/v1/analytics/get-experiments-for-GA",
|
url: "/analytics/api/v1/analytics/log-custom-event",
|
||||||
|
method: "POST",
|
||||||
|
},
|
||||||
|
GetExperimentsByUser: {
|
||||||
|
url: "/analytics/api/v1/analytics/get-experiments",
|
||||||
method: "GET",
|
method: "GET",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ const errorMessages = {
|
||||||
SERVICE_ZIP_FORMAT: "Please enter a valid Service ZIP",
|
SERVICE_ZIP_FORMAT: "Please enter a valid Service ZIP",
|
||||||
VIN_REQUIRED: "Please enter your VIN",
|
VIN_REQUIRED: "Please enter your VIN",
|
||||||
VIN_FORMAT: "Please enter a valid VIN",
|
VIN_FORMAT: "Please enter a valid VIN",
|
||||||
|
OPTION_REQUIRED: "Please select an option",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { errorMessages };
|
export { errorMessages };
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,9 @@ const storeActions = {
|
||||||
SET_REFERRAL_INFORMATION: "setReferralInformation",
|
SET_REFERRAL_INFORMATION: "setReferralInformation",
|
||||||
VALIDATE_ZIP: "validateZip",
|
VALIDATE_ZIP: "validateZip",
|
||||||
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
|
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
|
||||||
LOG_ACTIVITY: "logActivity",
|
LOG_PAGE_VIEW: "logPageView",
|
||||||
GET_EXPERIMENTS_BY_USER_FOR_GA: "getExperimentsByUserForGa",
|
LOG_CUSTOM_EVENT: "logCustomEvent",
|
||||||
|
GET_EXPERIMENTS_BY_USER: "GetExperimentsByUser",
|
||||||
|
|
||||||
// DEPENDENCY MUTATIONS
|
// DEPENDENCY MUTATIONS
|
||||||
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const storeMutations = {
|
||||||
UPDATE_REGISTRATION_ZIP_CODE: "updateRegistrationZipCode",
|
UPDATE_REGISTRATION_ZIP_CODE: "updateRegistrationZipCode",
|
||||||
UPDATE_REGISTRATION_FIRST_NAME: "updateRegistrationFirstName",
|
UPDATE_REGISTRATION_FIRST_NAME: "updateRegistrationFirstName",
|
||||||
UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName",
|
UPDATE_REGISTRATION_LAST_NAME: "updateRegistrationLastName",
|
||||||
UPDATE_SERVICE_LOCATION_ZIP: "updateServiceLocationZip",
|
UPDATE_SERVICE_LOCATION_ZIP_CODE: "updateServiceLocationZipCode",
|
||||||
UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress",
|
UPDATE_CUSTOMER_EMAIL_ADDRESS: "updateCustomerEmailAddress",
|
||||||
|
|
||||||
// ORDER MUTATIONS
|
// ORDER MUTATIONS
|
||||||
|
|
|
||||||
7
src/constants/vin-lookup-method-selections.js
Normal file
7
src/constants/vin-lookup-method-selections.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
const vinLookupMethodSelections = {
|
||||||
|
MANUALVIN: "ManualVin",
|
||||||
|
LICENSEPLATE: "LicensePlate",
|
||||||
|
HOMEADDRESS: "HomeAddress",
|
||||||
|
};
|
||||||
|
|
||||||
|
export { vinLookupMethodSelections };
|
||||||
|
|
@ -93,9 +93,9 @@ async function getLatestPageForRedirection() {
|
||||||
return fmgPageValues.VEHICLE_DAMAGE;
|
return fmgPageValues.VEHICLE_DAMAGE;
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.vehicle.vin) {
|
if (store.getters.vehicle.vin) {
|
||||||
return fmgPageValues.LICENSE_PLATE_LOOKUP;
|
|
||||||
} else {
|
|
||||||
return fmgPageValues.VIN_LOOKUP;
|
return fmgPageValues.VIN_LOOKUP;
|
||||||
|
} else {
|
||||||
|
return fmgPageValues.ESTIMATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
expect(result).toBe('vehicle-damage');
|
expect(result).toBe('vehicle-damage');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getPageToRouteExistingOrderTo, should return license-plate-lookup", async () => {
|
test("getPageToRouteExistingOrderTo, should return vin-lookup", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const toRoute = {
|
const toRoute = {
|
||||||
query: {}
|
query: {}
|
||||||
|
|
@ -228,7 +228,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(result).toBe('license-plate-lookup');
|
expect(result).toBe('vin-lookup');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getPageToRouteExistingOrderTo, should return estimate", async () => {
|
test("getPageToRouteExistingOrderTo, should return estimate", async () => {
|
||||||
|
|
@ -283,7 +283,7 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
const result = await getPageToRouteExistingOrderTo(toRoute, false);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(result).toBe('vin-lookup');
|
expect(result).toBe('estimate');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => {
|
test("getPageToRouteExistingOrderTo, existing order, should return heritage", async () => {
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ export default {
|
||||||
return store.getters.order.customer.emailAddress;
|
return store.getters.order.customer.emailAddress;
|
||||||
},
|
},
|
||||||
getServiceZipFromStore() {
|
getServiceZipFromStore() {
|
||||||
return store.getters.order.serviceLocation.zip;
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
this.resetWarningsAndErrors();
|
this.resetWarningsAndErrors();
|
||||||
|
|
@ -302,7 +302,7 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zipCode);
|
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.customerQuestions.addressQuestions.zipCode);
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName);
|
store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, this.customerQuestions.firstName);
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName);
|
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, this.customerQuestions.lastName);
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip);
|
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip);
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.email);
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.email);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,131 @@
|
||||||
<template>
|
<template>
|
||||||
<p> Estimate </p>
|
<Form
|
||||||
|
@submit="onSubmit"
|
||||||
|
@invalid-submit="onInvalidSubmit"
|
||||||
|
ref="theForm"
|
||||||
|
v-slot="{ meta }"
|
||||||
|
>
|
||||||
|
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||||
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||||
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" />
|
||||||
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
|
<buttonQuestion
|
||||||
|
cmsWidgetName="VinLookupMethod"
|
||||||
|
class="button-question-overflow"
|
||||||
|
:questionText="questionText"
|
||||||
|
:answers="answersFromCms"
|
||||||
|
groupName="vinLookupMethodOption"
|
||||||
|
buttonType="listButton"
|
||||||
|
v-model="selectedValues"
|
||||||
|
isRequired
|
||||||
|
validationRules="option-required"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<funnel-footer
|
||||||
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
:isForwardActionDisabled="!meta.valid"
|
||||||
|
@isDisabled="!meta.valid"
|
||||||
|
@back-clicked="backButtonAction"
|
||||||
|
@ForwardClicked="forwardButtonAction"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// Components
|
||||||
|
import funnelHeader from "@/common-components/funnel-header/funnel-header";
|
||||||
|
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
||||||
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
|
import buttonQuestion from "@/common-components/button-question/button-question";
|
||||||
|
//Supporting Files
|
||||||
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
import { required } from "@/helpers/validation-rules";
|
||||||
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
|
import { Form, defineRule } from "vee-validate";
|
||||||
|
import store from "@/store";
|
||||||
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
|
// Define Validation Rules
|
||||||
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
export default {
|
export default {
|
||||||
name: "estimate",
|
name: "estimate",
|
||||||
methods: {
|
data() {
|
||||||
arePagePrerequisitesValid() {
|
return {
|
||||||
return true;
|
selectedValues: [],
|
||||||
},
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
//Call APIs
|
||||||
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
//Settle promises and get results
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "cmsContent",
|
||||||
|
promise: cmsContentPromise,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
next((vm) => {
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
if(store.getters.damage.isRepair!=null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
resetDependentState() {},
|
||||||
|
backButtonAction() {
|
||||||
|
// route to move backwards
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.CLICKED_BACK,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
},
|
||||||
|
forwardButtonAction() {
|
||||||
|
if (this.selectedValues[0]===vinLookupMethodSelections.MANUALVIN) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.SELECTED_MANUAL_VIN,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.selectedValues[0]===vinLookupMethodSelections.LICENSEPLATE) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.SELECTED_LICENSE_PLATE,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.selectedValues[0]===vinLookupMethodSelections.HOMEADDRESS) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.SELECTED_HOME_ADDRESS,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
questionText() {
|
||||||
|
return this.getCmsContent("VinLookupMethod", "QuestionText");
|
||||||
|
},
|
||||||
|
answersFromCms() {
|
||||||
|
return this.getCmsContent("VinLookupMethod", "Answers");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
funnelHeader,
|
||||||
|
vehicleBanner,
|
||||||
|
funnelSubHeader,
|
||||||
|
funnelFooter,
|
||||||
|
buttonQuestion,
|
||||||
|
Form,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -33,7 +33,7 @@ jest.mock("@/store", () => ({
|
||||||
emailAddress: "test@test.com"
|
emailAddress: "test@test.com"
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
zip: "43443"
|
zipCode: "43443"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
vehicle: {
|
vehicle: {
|
||||||
|
|
|
||||||
|
|
@ -1,106 +1,35 @@
|
||||||
<template>
|
<template>
|
||||||
<Form
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||||
@submit="onSubmit"
|
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5">
|
||||||
@invalid-submit="onInvalidSubmit"
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
||||||
ref="theForm"
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" :displayGenericVehicleImage="false" />
|
||||||
v-slot="{ meta }"
|
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
>
|
<div class="row my-2">
|
||||||
<div
|
<div class="col">
|
||||||
class="container-fluid shadow rounded-3 p-2 position-relative make-tall px-5"
|
<textboxQuestion cmsWidgetName="LicensePlateNumber" v-model="licensePlate" isRequired inputId="license_plate" validationRules="license-plate-required" />
|
||||||
>
|
</div>
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" />
|
|
||||||
<vehicleBanner
|
|
||||||
cmsWidgetName="VehicleBannerWidget"
|
|
||||||
:displayGenericVehicleImage="false"
|
|
||||||
/>
|
|
||||||
<funnelSubHeader cmsWidgetName="FunnelSubHeaderWidget" />
|
|
||||||
<div class="row my-2">
|
|
||||||
<div class="col">
|
|
||||||
<textboxQuestion
|
|
||||||
cmsWidgetName="LicensePlateNumber"
|
|
||||||
v-model="licensePlate"
|
|
||||||
isRequired
|
|
||||||
inputId="license_plate"
|
|
||||||
validationRules="license-plate-required"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row my-2">
|
||||||
<div class="row my-2">
|
<div class="col">
|
||||||
<div class="col">
|
<textboxQuestion cmsWidgetName="RegistrationZip" v-model="registrationZip" inputId="zip" mask="#####" validationRules="zip-required" />
|
||||||
<textboxQuestion
|
</div>
|
||||||
cmsWidgetName="RegistrationZip"
|
|
||||||
v-model="registrationZip"
|
|
||||||
inputId="zip"
|
|
||||||
mask="#####"
|
|
||||||
validationRules="zip-required"
|
|
||||||
/>
|
|
||||||
<textboxQuestion
|
|
||||||
cmsWidgetName="RegistrationZip"
|
|
||||||
v-model="registrationZip"
|
|
||||||
isRequired
|
|
||||||
inputId="zip"
|
|
||||||
mask="#####"
|
|
||||||
validationRules="zip-required"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row my-2">
|
||||||
<div class="row my-2">
|
<div class="col">
|
||||||
<div class="col">
|
<textboxQuestion cmsWidgetName="EmailAddress" v-model="email" inputId="email" validationRules="email-address-required|email-address-format" />
|
||||||
<textboxQuestion
|
</div>
|
||||||
cmsWidgetName="EmailAddress"
|
|
||||||
v-model="email"
|
|
||||||
inputId="email"
|
|
||||||
validationRules="email-address-required|email-address-format"
|
|
||||||
/>
|
|
||||||
<textboxQuestion
|
|
||||||
cmsWidgetName="EmailAddress"
|
|
||||||
v-model="email"
|
|
||||||
isRequired
|
|
||||||
inputId="email"
|
|
||||||
validationRules="email-address-required|email-address-format"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<alert class="my-3" :manualHeadline="NoServiceZipHeader" :manualCopy="NoServiceZipBody" v-if="!isRegistrationZipServicable && isVinValid && !isCarIdDifferent" alertClass="alert-danger" />
|
||||||
<alert
|
<div class="row my-2">
|
||||||
class="my-3"
|
<div class="col">
|
||||||
:manualHeadline="NoServiceZipHeader"
|
<textboxQuestion v-if="!isRegistrationZipServicable" cmsWidgetName="ServiceZip" v-model="serviceZip" inputId="serviceZip" validationRules="zip-required" />
|
||||||
:manualCopy="NoServiceZipBody"
|
</div>
|
||||||
v-if="!isRegistrationZipServicable && isVinValid && !isCarIdDifferent"
|
|
||||||
alertClass="alert-danger"
|
|
||||||
/>
|
|
||||||
<div class="row my-2">
|
|
||||||
<div class="col">
|
|
||||||
<textboxQuestion
|
|
||||||
v-if="!isRegistrationZipServicable"
|
|
||||||
cmsWidgetName="ServiceZip"
|
|
||||||
v-model="serviceZip"
|
|
||||||
inputId="serviceZip"
|
|
||||||
validationRules="zip-required"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<alert class="my-3" cmsWidgetName="NoMatchAlertWidget" v-if="!isVinValid" alertClass="alert-danger" />
|
||||||
<alert
|
<alert class="my-3" :manualHeadline="MatchedDifferentVehicleAlertHeader" :manualCopy="MatchedDifferentVehicleAlertBody" v-if="isCarIdDifferent" alertClass="alert-warning" />
|
||||||
class="my-3"
|
<funnelFooter ref="funnelFooter" cmsWidgetName="FunnelFooterWidget" :isForwardActionDisabled="!meta.valid" @back-clicked="backButtonAction" @ForwardClicked="forwardButtonAction" />
|
||||||
cmsWidgetName="NoMatchAlertWidget"
|
|
||||||
v-if="!isVinValid"
|
|
||||||
alertClass="alert-danger"
|
|
||||||
/>
|
|
||||||
<alert
|
|
||||||
class="my-3"
|
|
||||||
:manualHeadline="MatchedDifferentVehicleAlertHeader"
|
|
||||||
:manualCopy="MatchedDifferentVehicleAlertBody"
|
|
||||||
v-if="isCarIdDifferent"
|
|
||||||
alertClass="alert-warning"
|
|
||||||
/>
|
|
||||||
<funnelFooter
|
|
||||||
ref="funnelFooter"
|
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
|
||||||
:isForwardActionDisabled="!meta.valid"
|
|
||||||
@back-clicked="backButtonAction"
|
|
||||||
@ForwardClicked="forwardButtonAction"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -113,37 +42,55 @@ import alert from "@/ux-components/alert/alert";
|
||||||
import textboxQuestion from "@/common-components/textbox-question/textbox-question";
|
import textboxQuestion from "@/common-components/textbox-question/textbox-question";
|
||||||
|
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import {
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
fetchCmsContentForPage
|
||||||
|
} from "@/helpers/cms-content-helper";
|
||||||
|
import {
|
||||||
|
settleAllPromises
|
||||||
|
} from "@/helpers/layout-helper";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
|
||||||
import {
|
import {
|
||||||
getDamageString,
|
storeActions
|
||||||
isGlassAvailableForCarId,
|
} from "@/constants/store-actions";
|
||||||
|
import {
|
||||||
|
storeMutations
|
||||||
|
} from "@/constants/store-mutations";
|
||||||
|
import {
|
||||||
|
errorMessages
|
||||||
|
} from "@/constants/error-messages";
|
||||||
|
import {
|
||||||
|
getDamageString,
|
||||||
|
isGlassAvailableForCarId,
|
||||||
} from "@/helpers/damage-helper";
|
} from "@/helpers/damage-helper";
|
||||||
import { required, regex } from "@/helpers/validation-rules";
|
import {
|
||||||
import { Form, defineRule } from "vee-validate";
|
required,
|
||||||
import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
regex
|
||||||
|
} from "@/helpers/validation-rules";
|
||||||
|
import {
|
||||||
|
Form,
|
||||||
|
defineRule
|
||||||
|
} from "vee-validate";
|
||||||
|
import {
|
||||||
|
navigateAfterSaveToHeritageFunnel
|
||||||
|
} from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule(
|
defineRule(
|
||||||
"license-plate-required",
|
"license-plate-required",
|
||||||
required(errorMessages.LICENSE_PLATE_REQUIRED)
|
required(errorMessages.LICENSE_PLATE_REQUIRED)
|
||||||
);
|
);
|
||||||
defineRule("zip-required", required(errorMessages.ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.ZIP_REQUIRED));
|
||||||
defineRule(
|
defineRule(
|
||||||
"email-address-required",
|
"email-address-required",
|
||||||
required(errorMessages.EMAIL_ADDRESS_REQUIRED)
|
required(errorMessages.EMAIL_ADDRESS_REQUIRED)
|
||||||
);
|
);
|
||||||
defineRule(
|
defineRule(
|
||||||
"email-address-format",
|
"email-address-format",
|
||||||
regex(
|
regex(
|
||||||
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+).([a-zA-Z]{2,})$/,
|
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+).([a-zA-Z]{2,})$/,
|
||||||
errorMessages.EMAIL_ADDRESS_FORMAT
|
errorMessages.EMAIL_ADDRESS_FORMAT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -191,211 +138,249 @@ export default {
|
||||||
"HeadlineText"
|
"HeadlineText"
|
||||||
).replaceAll("{custom:damage}", getDamageString());
|
).replaceAll("{custom:damage}", getDamageString());
|
||||||
|
|
||||||
return text;
|
// Settle promises and get results
|
||||||
},
|
const promiseResultMap = [{
|
||||||
MatchedDifferentVehicleAlertBody() {
|
resultKey: "cmsContent",
|
||||||
let text = this.getCmsContent(
|
promise: cmsContentPromise,
|
||||||
"MatchedDifferentVehicleAlertWidget",
|
}, ];
|
||||||
"BodyText"
|
|
||||||
)
|
|
||||||
.replaceAll("{custom:damage}", getDamageString())
|
|
||||||
.replaceAll(
|
|
||||||
"{custom:plateLookupYear}",
|
|
||||||
this.customAlertData?.vehicleInfo?.year
|
|
||||||
)
|
|
||||||
.replaceAll(
|
|
||||||
"{custom:plateLookupMake}",
|
|
||||||
this.customAlertData?.vehicleInfo?.make
|
|
||||||
)
|
|
||||||
.replaceAll(
|
|
||||||
"{custom:plateLookupModel}",
|
|
||||||
this.customAlertData?.vehicleInfo?.model
|
|
||||||
);
|
|
||||||
|
|
||||||
return text;
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
},
|
|
||||||
NoServiceZipHeader() {
|
|
||||||
let text = this.getCmsContent(
|
|
||||||
"NoServiceZipWidget",
|
|
||||||
"HeadlineText"
|
|
||||||
).replaceAll("{custom:zip}", this.registrationZip);
|
|
||||||
|
|
||||||
return text;
|
// Call the "next" function to complete the transition to this page.
|
||||||
|
next((vm) => {
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
NoServiceZipBody() {
|
props: {
|
||||||
return this.getCmsContent("NoServiceZipWidget", "BodyText");
|
validationRules: String,
|
||||||
},
|
},
|
||||||
},
|
data() {
|
||||||
methods: {
|
return {
|
||||||
arePagePrerequisitesValid() {
|
isRegistrationZipServicable: true,
|
||||||
return store.getters.vehicle.carId !== null;
|
isVinValid: true,
|
||||||
|
isCarIdDifferent: false,
|
||||||
|
licensePlate: this.getLicensePlateFromStore(),
|
||||||
|
registrationZip: this.getRegistrationZipFromStore(),
|
||||||
|
email: this.getEmailFromStore(),
|
||||||
|
serviceZip: this.getServiceZipFromStore(),
|
||||||
|
previouslyEnteredCarId: "",
|
||||||
|
customAlertData: {},
|
||||||
|
isSelectedGlassAvailableForVehicle: true,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
resetDependentState() {
|
mounted() {
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null);
|
this.attachCustomEvents();
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_CITY, null);
|
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null);
|
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null);
|
|
||||||
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
},
|
},
|
||||||
attachCustomEvents() {
|
computed: {
|
||||||
this.prependActionToMethod(this, this.forwardButtonAction, () => {
|
MatchedDifferentVehicleAlertHeader() {
|
||||||
this.pushEventToGA(
|
let text = this.getCmsContent(
|
||||||
this.$route.query[this.queryStrings.FMG_PAGE],
|
"MatchedDifferentVehicleAlertWidget",
|
||||||
this.GaActions.SUBMITTED,
|
"HeadlineText"
|
||||||
this.GaLabels.LICENSE_PLATE_LOOKUP,
|
).replaceAll("{custom:damage}", getDamageString());
|
||||||
true
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getLicensePlateFromStore() {
|
|
||||||
return store.getters.vehicle.registration.licensePlate;
|
|
||||||
},
|
|
||||||
getRegistrationZipFromStore() {
|
|
||||||
return store.getters.vehicle.registration.zipCode;
|
|
||||||
},
|
|
||||||
getEmailFromStore() {
|
|
||||||
return store.getters.order.customer.emailAddress;
|
|
||||||
},
|
|
||||||
getServiceZipFromStore() {
|
|
||||||
return store.getters.order.serviceLocation.zip;
|
|
||||||
},
|
|
||||||
backButtonAction() {
|
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
|
||||||
},
|
|
||||||
async forwardButtonAction() {
|
|
||||||
const zipValidation = this.serviceZip
|
|
||||||
? await this.validateZip(this.serviceZip)
|
|
||||||
: await this.validateZip(this.registrationZip);
|
|
||||||
if (!zipValidation.data.isServiceable) {
|
|
||||||
this.$refs.funnelFooter.removeLoader();
|
|
||||||
this.isVinValid = true;
|
|
||||||
this.isRegistrationZipServicable = false;
|
|
||||||
this.isCarIdDifferent = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const vinLookup = await this.lookupVin(
|
return text;
|
||||||
this.licensePlate,
|
},
|
||||||
zipValidation.data.state
|
MatchedDifferentVehicleAlertBody() {
|
||||||
).catch(() => {
|
let text = this.getCmsContent(
|
||||||
this.$refs.funnelFooter.removeLoader();
|
"MatchedDifferentVehicleAlertWidget",
|
||||||
this.isVinValid = false;
|
"BodyText"
|
||||||
this.isCarIdDifferent = false;
|
)
|
||||||
return;
|
.replaceAll("{custom:damage}", getDamageString())
|
||||||
});
|
.replaceAll(
|
||||||
|
"{custom:plateLookupYear}",
|
||||||
this.isCarIdDifferent =
|
this.customAlertData?.vehicleInfo?.year
|
||||||
vinLookup.data.vehicle.carId !== store.getters.vehicle.carId;
|
)
|
||||||
|
.replaceAll(
|
||||||
if (
|
"{custom:plateLookupMake}",
|
||||||
this.isCarIdDifferent &&
|
this.customAlertData?.vehicleInfo?.make
|
||||||
vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId
|
)
|
||||||
) {
|
.replaceAll(
|
||||||
this.previouslyEnteredCarId = vinLookup.data.vehicle.carId;
|
"{custom:plateLookupModel}",
|
||||||
this.customAlertData.vehicleInfo = vinLookup.data.vehicle;
|
this.customAlertData?.vehicleInfo?.model
|
||||||
this.$refs.funnelFooter.updateButtonText(
|
);
|
||||||
`Continue with ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`
|
|
||||||
);
|
return text;
|
||||||
this.isVinValid = true;
|
},
|
||||||
this.isSelectedGlassAvailableForVehicle =
|
NoServiceZipHeader() {
|
||||||
await isGlassAvailableForCarId(vinLookup.data.vehicle.carId);
|
let text = this.getCmsContent(
|
||||||
this.$refs.funnelFooter.removeLoader();
|
"NoServiceZipWidget",
|
||||||
return;
|
"HeadlineText"
|
||||||
}
|
).replaceAll("{custom:zip}", this.registrationZip);
|
||||||
|
|
||||||
this.updateCustomerInfo(
|
return text;
|
||||||
vinLookup.data.vin,
|
},
|
||||||
vinLookup.data.vehicle,
|
NoServiceZipBody() {
|
||||||
zipValidation.data.state
|
return this.getCmsContent("NoServiceZipWidget", "BodyText");
|
||||||
);
|
|
||||||
|
|
||||||
const partsData = await baseMixin.methods.dispatchStoreAction(
|
|
||||||
this.storeActions.GET_PARTS_OR_QUESTIONS,
|
|
||||||
{
|
|
||||||
carId: vinLookup.data.vehicle.carId,
|
|
||||||
glassArray:
|
|
||||||
this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle
|
|
||||||
? []
|
|
||||||
: store.getters.damage.glassToReplace,
|
|
||||||
zipCode: this.serviceZip ? this.serviceZip : this.registrationZip,
|
|
||||||
vin: vinLookup.data.vin,
|
|
||||||
},
|
},
|
||||||
false
|
|
||||||
);
|
|
||||||
this.navigateForward(partsData);
|
|
||||||
},
|
},
|
||||||
navigateForward(partsData) {
|
methods: {
|
||||||
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
arePagePrerequisitesValid() {
|
||||||
this.$router.navigateAfterSave(
|
return store.getters.vehicle.carId !== null;
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
},
|
||||||
this.$route,
|
resetDependentState() {
|
||||||
{},
|
store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null);
|
||||||
{ displayVehicleChangeAlert: true },
|
store.commit(storeMutations.UPDATE_REGISTRATION_CITY, null);
|
||||||
partsData.data
|
store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null);
|
||||||
);
|
store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null);
|
||||||
return;
|
store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
} else {
|
},
|
||||||
navigateAfterSaveToHeritageFunnel(this.$route);
|
attachCustomEvents() {
|
||||||
return;
|
this.prependActionToMethod(this, this.forwardButtonAction, () => {
|
||||||
}
|
this.pushEventToGA(
|
||||||
|
this.$route.query[this.queryStrings.FMG_PAGE],
|
||||||
|
this.GaActions.SUBMITTED,
|
||||||
|
this.GaLabels.LICENSE_PLATE_LOOKUP,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getLicensePlateFromStore() {
|
||||||
|
return store.getters.vehicle.registration.licensePlate;
|
||||||
|
},
|
||||||
|
getRegistrationZipFromStore() {
|
||||||
|
return store.getters.vehicle.registration.zipCode;
|
||||||
|
},
|
||||||
|
getEmailFromStore() {
|
||||||
|
return store.getters.order.customer.emailAddress;
|
||||||
|
},
|
||||||
|
getServiceZipFromStore() {
|
||||||
|
return store.getters.order.serviceLocation.zipCode
|
||||||
|
},
|
||||||
|
backButtonAction() {
|
||||||
|
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
|
},
|
||||||
|
async forwardButtonAction() {
|
||||||
|
const zipValidation = this.serviceZip ?
|
||||||
|
await this.validateZip(this.serviceZip) :
|
||||||
|
await this.validateZip(this.registrationZip);
|
||||||
|
if (!zipValidation.data.isServiceable) {
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.isVinValid = true;
|
||||||
|
this.isRegistrationZipServicable = false;
|
||||||
|
this.isCarIdDifferent = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vinLookup = await this.lookupVin(
|
||||||
|
this.licensePlate,
|
||||||
|
zipValidation.data.state
|
||||||
|
).catch(() => {
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
this.isVinValid = false;
|
||||||
|
this.isCarIdDifferent = false;
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.isCarIdDifferent =
|
||||||
|
vinLookup.data.vehicle.carId !== store.getters.vehicle.carId;
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.isCarIdDifferent &&
|
||||||
|
vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId
|
||||||
|
) {
|
||||||
|
this.previouslyEnteredCarId = vinLookup.data.vehicle.carId;
|
||||||
|
this.customAlertData.vehicleInfo = vinLookup.data.vehicle;
|
||||||
|
this.$refs.funnelFooter.updateButtonText(
|
||||||
|
`Continue with ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`
|
||||||
|
);
|
||||||
|
this.isVinValid = true;
|
||||||
|
this.isSelectedGlassAvailableForVehicle =
|
||||||
|
await isGlassAvailableForCarId(vinLookup.data.vehicle.carId);
|
||||||
|
this.$refs.funnelFooter.removeLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateCustomerInfo(
|
||||||
|
vinLookup.data.vin,
|
||||||
|
vinLookup.data.vehicle,
|
||||||
|
zipValidation.data.state
|
||||||
|
);
|
||||||
|
|
||||||
|
const partsData = await baseMixin.methods.dispatchStoreAction(
|
||||||
|
this.storeActions.GET_PARTS_OR_QUESTIONS, {
|
||||||
|
carId: vinLookup.data.vehicle.carId,
|
||||||
|
glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace,
|
||||||
|
zipCode: this.serviceZip ? this.serviceZip : this.registrationZip,
|
||||||
|
vin: vinLookup.data.vin,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
this.navigateForward(partsData);
|
||||||
|
},
|
||||||
|
navigateForward(partsData) {
|
||||||
|
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||||
|
this.$router.navigateAfterSave(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
|
this.$route, {}, {
|
||||||
|
displayVehicleChangeAlert: true
|
||||||
|
},
|
||||||
|
partsData.data
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
navigateAfterSaveToHeritageFunnel(this.$route);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateZip(zip) {
|
||||||
|
return baseMixin.methods.dispatchStoreAction(storeActions.VALIDATE_ZIP, {
|
||||||
|
zip,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
lookupVin(plate, state) {
|
||||||
|
return baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.LOOKUP_VIN_BY_PLATE, {
|
||||||
|
licensePlate: plate,
|
||||||
|
licenseState: state
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
updateCustomerInfo(vin, vehicleInfo, registrationState) {
|
||||||
|
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
||||||
|
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
|
}
|
||||||
|
store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin);
|
||||||
|
store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year);
|
||||||
|
store.commit(storeMutations.UPDATE_MAKE, vehicleInfo.make);
|
||||||
|
store.commit(storeMutations.UPDATE_MODEL, vehicleInfo.model);
|
||||||
|
store.commit(storeMutations.UPDATE_STYLE, vehicleInfo.style);
|
||||||
|
store.commit(storeMutations.UPDATE_CAR_ID, vehicleInfo.carId);
|
||||||
|
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, vehicleInfo.category);
|
||||||
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, vehicleInfo.imageUrl);
|
||||||
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, vehicleInfo.imageVifNumber);
|
||||||
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, vehicleInfo.imageColor);
|
||||||
|
store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, this.licensePlate);
|
||||||
|
store.commit(storeMutations.UPDATE_REGISTRATION_STATE, registrationState);
|
||||||
|
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.registrationZip);
|
||||||
|
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.serviceZip);
|
||||||
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
validateZip(zip) {
|
watch: {
|
||||||
return baseMixin.methods.dispatchStoreAction(storeActions.VALIDATE_ZIP, {
|
licensePlate() {
|
||||||
zip,
|
this.$refs.funnelFooter.updateButtonText(
|
||||||
});
|
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
registrationZip() {
|
||||||
|
this.$refs.funnelFooter.updateButtonText(
|
||||||
|
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
serviceZip() {
|
||||||
|
this.$refs.funnelFooter.updateButtonText(
|
||||||
|
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
lookupVin(plate, state) {
|
components: {
|
||||||
return baseMixin.methods.dispatchStoreAction(
|
Form,
|
||||||
storeActions.LOOKUP_VIN_BY_PLATE,
|
funnelHeader,
|
||||||
{ licensePlate: plate, licenseState: state }
|
vehicleBanner,
|
||||||
);
|
funnelSubHeader,
|
||||||
|
textboxQuestion,
|
||||||
|
alert,
|
||||||
|
funnelFooter,
|
||||||
},
|
},
|
||||||
updateCustomerInfo(vin, vehicleInfo, registrationState) {
|
|
||||||
if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) {
|
|
||||||
store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin);
|
|
||||||
store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year);
|
|
||||||
store.commit(storeMutations.UPDATE_MAKE, vehicleInfo.make);
|
|
||||||
store.commit(storeMutations.UPDATE_MODEL, vehicleInfo.model);
|
|
||||||
store.commit(storeMutations.UPDATE_STYLE, vehicleInfo.style);
|
|
||||||
store.commit(storeMutations.UPDATE_CAR_ID, vehicleInfo.carId);
|
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY,vehicleInfo.category);
|
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL,vehicleInfo.imageUrl);
|
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER,vehicleInfo.imageVifNumber);
|
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR,vehicleInfo.imageColor);
|
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE,this.licensePlate);
|
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_STATE, registrationState);
|
|
||||||
store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE,this.registrationZip);
|
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip);
|
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
licensePlate() {
|
|
||||||
this.$refs.funnelFooter.updateButtonText(
|
|
||||||
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
registrationZip() {
|
|
||||||
this.$refs.funnelFooter.updateButtonText(
|
|
||||||
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
serviceZip() {
|
|
||||||
this.$refs.funnelFooter.updateButtonText(
|
|
||||||
this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
Form,
|
|
||||||
funnelHeader,
|
|
||||||
vehicleBanner,
|
|
||||||
funnelSubHeader,
|
|
||||||
textboxQuestion,
|
|
||||||
alert,
|
|
||||||
funnelFooter,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -182,66 +182,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
|
||||||
test("Windshield replace with single part on ForwardButtonAction triggers a router.navigate and saves selections to store", async () => {
|
|
||||||
//Arrange
|
|
||||||
const partsData = { partsOrQuestions: [
|
|
||||||
{
|
|
||||||
glassLocation: "Windshield",
|
|
||||||
glassName: "Single",
|
|
||||||
partQuestions: null,
|
|
||||||
parts: [
|
|
||||||
{
|
|
||||||
color: "Green Tint, Green Shade",
|
|
||||||
description: "rain sensor, solar",
|
|
||||||
partNumber: "FW02728GGYN",
|
|
||||||
requiresCapabilityQuestions: false,
|
|
||||||
requiresRecalibration: false
|
|
||||||
}
|
|
||||||
]}]};
|
|
||||||
|
|
||||||
const { wrapper } = setupMocks({
|
|
||||||
pageHeaderWidgetHeaderText: "",
|
|
||||||
mountOptionsMockData: {
|
|
||||||
router: { navigate: jest.fn(), },
|
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
|
|
||||||
store: {
|
|
||||||
getters: {
|
|
||||||
vehicle: {},
|
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.vm.selectedDamageLocations = ["Windshield"];
|
|
||||||
wrapper.vm.selectedWindshieldOptions = {
|
|
||||||
selectedWindshieldChipCount : null,
|
|
||||||
selectedWindshieldReplaceOptions : ["Single"],
|
|
||||||
selectedWindshieldDamageType: ["Replace"]
|
|
||||||
};
|
|
||||||
|
|
||||||
const expectedGlassToReplace = [{location: "Windshield", name: "Single"},];
|
|
||||||
|
|
||||||
//Act
|
|
||||||
vehicleDamage.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle-damage" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.vm.forwardButtonAction();
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
|
||||||
expect(wrapper.vm.selectedGlassToReplace()).toEqual(expectedGlassToReplace);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, false);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_GLASS_TO_REPLACE, expectedGlassToReplace);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_PARTS, partsData.partsOrQuestions[0].parts);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("Windshield replace with multiple parts on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => {
|
test("Windshield replace with multiple parts on ForwardButtonAction triggers a router.navigateAfterSave and saves selections to store", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
@ -332,48 +272,6 @@ describe("vehicle-damage.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
|
||||||
test("Windshield repair on ForwardButtonAction triggers a router.navigate and saves selection to store", async () => {
|
|
||||||
//Arrange
|
|
||||||
const partsData = { partsOrQuestions: []};
|
|
||||||
const { wrapper } = setupMocks({
|
|
||||||
pageHeaderWidgetHeaderText: "",
|
|
||||||
mountOptionsMockData: {
|
|
||||||
router: { navigate: jest.fn(), },
|
|
||||||
actionList: [{ actionName: storeActions.GET_PARTS_OR_QUESTIONS, data: partsData, },],
|
|
||||||
store: {
|
|
||||||
getters: {
|
|
||||||
vehicle: {},
|
|
||||||
payment: { insuranceCoverage: { isVerified: false } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.vm.selectedDamageLocations = ["Windshield"];
|
|
||||||
wrapper.vm.selectedWindshieldOptions = {
|
|
||||||
selectedWindshieldChipCount : [2],
|
|
||||||
selectedWindshieldDamageType: ["Repair"]
|
|
||||||
};
|
|
||||||
|
|
||||||
//Act
|
|
||||||
vehicleDamage.beforeRouteEnter.call(
|
|
||||||
wrapper.vm,
|
|
||||||
{ query: { fmgPage: "vehicle-damage" } },
|
|
||||||
undefined,
|
|
||||||
(c) => c(wrapper.vm)
|
|
||||||
);
|
|
||||||
|
|
||||||
await wrapper.vm.forwardButtonAction();
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_IS_REPAIR, true);
|
|
||||||
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_NUMBER_OF_CHIPS, 2);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("vehicle-damage.vue", () => {
|
describe("vehicle-damage.vue", () => {
|
||||||
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
test("isWindshieldDamageLocation is true when windshield is selected", async () => {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,55 +293,20 @@ export default {
|
||||||
|
|
||||||
store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, this.selectedGlassToReplace());
|
store.commit(this.storeMutations.UPDATE_GLASS_TO_REPLACE, this.selectedGlassToReplace());
|
||||||
|
|
||||||
const partsData = await baseMixin.methods.dispatchStoreAction(this.storeActions.GET_PARTS_OR_QUESTIONS,
|
this.navigateForward();
|
||||||
{ carId: store.getters.vehicle.carId, glassArray: this.selectedGlassToReplace()}, false);
|
|
||||||
|
|
||||||
this.navigateForward(partsData);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
navigateForward(partsData){
|
navigateForward(){
|
||||||
|
|
||||||
// Temporary easter egg to navigate to heritage funnel.
|
|
||||||
const vehicleYearsToShowHeritageFunnel = [ 2001, 2002, 2010, 2016 ];
|
|
||||||
if (vehicleYearsToShowHeritageFunnel.includes(store.getters.vehicle.year)) {
|
|
||||||
navigateToHeritageFunnel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporary easter egg to navigate to address-lookup.
|
|
||||||
if (store.getters.vehicle.year === 2014) {
|
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.TEMPORARY_TO_ADDRESS_LOOKUP, this.$route, {}, {}, partsData.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If vin already exists, navigate directly to vin-lookup
|
// If vin already exists, navigate directly to vin-lookup
|
||||||
if(this.$store.getters.vehicle.vin){
|
if(store.getters.vehicle.vin) {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route);
|
this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//found multiple parts for a single glass location (Windshield, Driver, Passenger, Rear)
|
|
||||||
if (partsData.data.partsOrQuestions){
|
|
||||||
for (var i = 0; i < partsData.data.partsOrQuestions.length; i++){
|
|
||||||
if (partsData.data.partsOrQuestions[i].parts != null && partsData.data.partsOrQuestions[i].parts.length > 1){
|
|
||||||
this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if not a repair then there should only be 1 part and no problem questions at this point so save the part to the store.
|
|
||||||
if (!this.isWindshieldRepair){
|
|
||||||
store.commit(this.storeMutations.UPDATE_PARTS, partsData.data.partsOrQuestions[0].parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$router.navigate(this.navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART, this.$route);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedGlassToReplace() {
|
selectedGlassToReplace() {
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,7 @@ export default {
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, carInfo.imageUrl);
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, carInfo.imageUrl);
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, carInfo.imageVifNumber);
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, carInfo.imageVifNumber);
|
||||||
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageVifNumber);
|
store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageVifNumber);
|
||||||
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.zip);
|
store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP_CODE, this.zip);
|
||||||
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email);
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,24 +11,34 @@ const currentPageName = getPageNameByQueryString();
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
logEvent(pageEvent, category, action, label, value) {
|
logPageView(pageEvent) {
|
||||||
var payload = {
|
var payload = {
|
||||||
userId: getDeviceIdValue(),
|
userId: getDeviceIdValue(),
|
||||||
sessionKey: getSessionKeyValue(),
|
sessionKey: getSessionKeyValue(),
|
||||||
pageName: currentPageName,
|
pageName: currentPageName,
|
||||||
sessionId: getSessionIdValue(),
|
sessionId: getSessionIdValue(),
|
||||||
|
action: '',
|
||||||
|
event: pageEvent,
|
||||||
shouldUseSessionId: true,
|
shouldUseSessionId: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (pageEvent) {
|
baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
|
||||||
payload.pageEvent = { action: '', event: pageEvent };
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if (category) {
|
logCustomEvent(category, action, label, value) {
|
||||||
payload.customEvent = { category: category, action: action, label: label, value: value };
|
var payload = {
|
||||||
}
|
userId: getDeviceIdValue(),
|
||||||
|
sessionKey: getSessionKeyValue(),
|
||||||
|
pageName: currentPageName,
|
||||||
|
sessionId: getSessionIdValue(),
|
||||||
|
category: category,
|
||||||
|
action: action,
|
||||||
|
label: label,
|
||||||
|
value: value,
|
||||||
|
shouldUseSessionId: true,
|
||||||
|
};
|
||||||
|
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.LOG_ACTIVITY, payload, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
pushEventToGA(category, action, label, pushToLogApp = false) {
|
pushEventToGA(category, action, label, pushToLogApp = false) {
|
||||||
|
|
@ -44,7 +54,7 @@ export default {
|
||||||
pushToDataLayerIfDefined(eventToBePushed);
|
pushToDataLayerIfDefined(eventToBePushed);
|
||||||
|
|
||||||
if (pushToLogApp) {
|
if (pushToLogApp) {
|
||||||
this.logEvent(undefined, category, action, label, undefined);
|
this.logCustomEvent(category, action, label, undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -58,11 +68,11 @@ export default {
|
||||||
|
|
||||||
pushToDataLayerIfDefined(pageViewEvent);
|
pushToDataLayerIfDefined(pageViewEvent);
|
||||||
|
|
||||||
this.logEvent(currentPageName, analyticsPageEvents.ENTRY);
|
this.logPageView(analyticsPageEvents.ENTRY);
|
||||||
},
|
},
|
||||||
|
|
||||||
pushExperimentsToDataLayer(experiments) {
|
pushExperimentsToDataLayer(experiments) {
|
||||||
experiments?.data?.forEach(exp => {
|
experiments?.forEach(exp => {
|
||||||
|
|
||||||
// Set Google Dimension Index based on experiment settings.
|
// Set Google Dimension Index based on experiment settings.
|
||||||
let googleDimensionIndex = 99;
|
let googleDimensionIndex = 99;
|
||||||
|
|
@ -72,11 +82,13 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create object with dimension index and value.
|
// Create object with dimension index and value.
|
||||||
const experimentWithDimension = {};
|
const experimentWithDimension = {
|
||||||
|
[`experimentId_${googleDimensionIndex}`]: exp.universeId,
|
||||||
Object.keys(exp).forEach(key => {
|
[`variationId_${googleDimensionIndex}`]: exp.variationId,
|
||||||
experimentWithDimension[`${key}_${googleDimensionIndex}`] = exp[key];
|
[`experimentName_${googleDimensionIndex}`]: exp.universeName,
|
||||||
});
|
[`variationName_${googleDimensionIndex}`]: exp.variationName,
|
||||||
|
[`customDimension_${googleDimensionIndex}`]: `${exp.universeId}_${exp.variationId}_${exp.universeName}_${exp.variationName}`
|
||||||
|
};
|
||||||
|
|
||||||
// Push to the data layer with the Google Custom Dimension Index.
|
// Push to the data layer with the Google Custom Dimension Index.
|
||||||
pushToDataLayerIfDefined(experimentWithDimension);
|
pushToDataLayerIfDefined(experimentWithDimension);
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,34 @@ import { setupMocksForJsFiles } from "@/helpers/unit-test-helper.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
|
||||||
describe("analyticsMixin.js", () => {
|
describe("analyticsMixin.js", () => {
|
||||||
test("logEvent: calls dispatch with type and payload", () => {
|
test("logPageView: calls dispatch with type and payload", () => {
|
||||||
const type = "";
|
const type = "";
|
||||||
const payload = {};
|
const payload = {};
|
||||||
|
|
||||||
const mockData = {
|
const mockData = {
|
||||||
actionList: [{
|
actionList: [{
|
||||||
actionName: storeActions.LOG_ACTIVITY
|
actionName: storeActions.LOG_PAGE_VIEW
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
const mocks = setupMocksForJsFiles(mockData);
|
const mocks = setupMocksForJsFiles(mockData);
|
||||||
|
|
||||||
analyticsMixin.methods.logEvent(type, payload);
|
analyticsMixin.methods.logPageView(type, payload);
|
||||||
|
|
||||||
|
expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("logCustomEvent: calls dispatch with type and payload", () => {
|
||||||
|
const type = "";
|
||||||
|
const payload = {};
|
||||||
|
|
||||||
|
const mockData = {
|
||||||
|
actionList: [{
|
||||||
|
actionName: storeActions.LOG_CUSTOM_EVENT
|
||||||
|
}],
|
||||||
|
}
|
||||||
|
const mocks = setupMocksForJsFiles(mockData);
|
||||||
|
|
||||||
|
analyticsMixin.methods.logCustomEvent(type, payload);
|
||||||
|
|
||||||
expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled();
|
expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled();
|
||||||
});
|
});
|
||||||
|
|
@ -23,7 +39,7 @@ describe("analyticsMixin.js", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const mockData = {
|
const mockData = {
|
||||||
actionList: [{
|
actionList: [{
|
||||||
actionName: storeActions.LOG_ACTIVITY
|
actionName: storeActions.LOG_CUSTOM_EVENT
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
const mocks = setupMocksForJsFiles(mockData);
|
const mocks = setupMocksForJsFiles(mockData);
|
||||||
|
|
@ -40,21 +56,27 @@ describe("analyticsMixin.js", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
window.dataLayer = [];
|
window.dataLayer = [];
|
||||||
|
|
||||||
const mockExperimentData = {
|
const mockExperimentData =
|
||||||
data: [
|
[
|
||||||
{
|
{
|
||||||
settings: {},
|
settings: {},
|
||||||
variationName: 'test',
|
variationName: 'test',
|
||||||
universeName: 'testUniverse'
|
universeName: 'testUniverse'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(window.dataLayer).toEqual([ { settings_99: {}, variationName_99: 'test', universeName_99: 'testUniverse' } ]);
|
expect(window.dataLayer).toEqual([{
|
||||||
|
experimentId_99: undefined,
|
||||||
|
variationId_99: undefined,
|
||||||
|
experimentName_99: 'testUniverse',
|
||||||
|
variationName_99: 'test',
|
||||||
|
customDimension_99: 'undefined_undefined_testUniverse_test'
|
||||||
|
}]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -62,21 +84,27 @@ describe("analyticsMixin.js", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
window.dataLayer = [];
|
window.dataLayer = [];
|
||||||
|
|
||||||
const mockExperimentData = {
|
const mockExperimentData =
|
||||||
data: [
|
[
|
||||||
{
|
{
|
||||||
settings: { "Google Custom Dimension Index": "5"},
|
settings: { "Google Custom Dimension Index": "5" },
|
||||||
variationName: 'test',
|
variationName: 'test',
|
||||||
universeName: 'testUniverse'
|
universeName: 'testUniverse'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
analyticsMixin.methods.pushExperimentsToDataLayer(mockExperimentData);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(window.dataLayer).toEqual([ { settings_5: {"Google Custom Dimension Index": "5"}, variationName_5: 'test', universeName_5: 'testUniverse' } ]);
|
expect(window.dataLayer).toEqual([{
|
||||||
|
experimentId_5: undefined,
|
||||||
|
variationId_5: undefined,
|
||||||
|
experimentName_5: 'testUniverse',
|
||||||
|
variationName_5: 'test',
|
||||||
|
customDimension_5: 'undefined_undefined_testUniverse_test'
|
||||||
|
}]);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -127,8 +127,11 @@ router.afterEach(async (to, from) => {
|
||||||
// Push page view to GA
|
// Push page view to GA
|
||||||
analyticsMixin.methods.pushPageViewToGA(to.query[queryStrings.FMG_PAGE]);
|
analyticsMixin.methods.pushPageViewToGA(to.query[queryStrings.FMG_PAGE]);
|
||||||
|
|
||||||
const assignedExperiments = await baseMixin.methods.dispatchStoreAction(storeActions.GET_EXPERIMENTS_BY_USER_FOR_GA, { userId: getDeviceIdValue() });
|
baseMixin.methods.dispatchStoreAction(storeActions.GET_EXPERIMENTS_BY_USER, { userId: getDeviceIdValue() })
|
||||||
analyticsMixin.methods.pushExperimentsToDataLayer(assignedExperiments);
|
.then( (response) => {
|
||||||
|
analyticsMixin.methods.pushExperimentsToDataLayer(response.data);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => {
|
router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => {
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ const navigationScenarios = {
|
||||||
CLICKED_FORWARD: "CLICKED_FORWARD",
|
CLICKED_FORWARD: "CLICKED_FORWARD",
|
||||||
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
|
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
|
||||||
SELECTED_PARTS: "SELECTED_PARTS",
|
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",
|
|
||||||
CONTINUING_WITH_PARTS_QUESTION: "CONTINUING_WITH_PARTS_QUESTION",
|
CONTINUING_WITH_PARTS_QUESTION: "CONTINUING_WITH_PARTS_QUESTION",
|
||||||
CONTINUING_WITH_MULTIPLE_PARTS: "CONTINUING_WITH_MULTIPLE_PARTS",
|
CONTINUING_WITH_MULTIPLE_PARTS: "CONTINUING_WITH_MULTIPLE_PARTS",
|
||||||
CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART",
|
CONTINUING_WITH_SINGLE_PART: "CONTINUING_WITH_SINGLE_PART",
|
||||||
CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES",
|
CONTINUING_WITH_MULTIPLE_VEHICLES: "CONTINUING_WITH_MULTIPLE_VEHICLES",
|
||||||
TEMPORARY_TO_ADDRESS_LOOKUP: "TEMPORARY_TO_ADDRESS_LOOKUP",
|
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
|
||||||
|
SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN",
|
||||||
|
SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
|
||||||
|
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { navigationScenarios };
|
export { navigationScenarios };
|
||||||
|
|
|
||||||
|
|
@ -59,23 +59,11 @@ const routingTable = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
||||||
destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scenario: navigationScenarios.SELECTED_DAMAGE_WITH_SINGLE_PART,
|
|
||||||
destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
scenario: navigationScenarios.SELECTED_DAMAGE_WITH_MULTIPLE_PARTS,
|
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.SELECTED_DAMAGE_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||||
destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP,//This might be temporary
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
},
|
|
||||||
{
|
|
||||||
scenario: navigationScenarios.TEMPORARY_TO_ADDRESS_LOOKUP,
|
|
||||||
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP, //This will be temporary
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -163,6 +151,26 @@ const routingTable = [
|
||||||
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
{fmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_MANUAL_VIN,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_LICENSE_PLATE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.LICENSE_PLATE_LOOKUP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_HOME_ADDRESS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const getDefaultState = () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
zip: null,
|
zipCode: null,
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
emailAddress: null,
|
emailAddress: null,
|
||||||
|
|
@ -433,36 +433,52 @@ export const actions = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
logActivity(context, { userId, sessionKey, pageName, sessionId, pageEvent, customEvent, shouldUseSessionId }) {
|
logPageView(context, { userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId }) {
|
||||||
var payload = {
|
var payload = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
sessionKey: sessionKey,
|
sessionKey: sessionKey,
|
||||||
sessionId: sessionId,
|
sessionId: sessionId,
|
||||||
pageName: pageName,
|
pageName: pageName,
|
||||||
applicationName: 'SafeliteDotCom',
|
applicationName: 'SafeliteDotCom',
|
||||||
|
action: action,
|
||||||
|
event: event,
|
||||||
shouldUseSessionId: shouldUseSessionId
|
shouldUseSessionId: shouldUseSessionId
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof pageEvent !== 'undefined') {
|
|
||||||
payload.pageEvent = { action: pageEvent.action, event: pageEvent.event};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof customEvent !== 'undefined') {
|
|
||||||
payload.customEvents = [{category: customEvent.category, action: customEvent.action, label: customEvent.label, value: customEvent.value}];
|
|
||||||
}
|
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.LogActivity.method,
|
method: endpoints.LogPageView.method,
|
||||||
endpoint: endpoints.LogActivity.url,
|
endpoint: endpoints.LogPageView.url,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
logApiCall: false
|
logApiCall: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getExperimentsByUserForGa(context, { userId }){
|
logCustomEvent(context, { userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId }) {
|
||||||
|
var payload = {
|
||||||
|
userId: userId,
|
||||||
|
sessionKey: sessionKey,
|
||||||
|
sessionId: sessionId,
|
||||||
|
pageName: pageName,
|
||||||
|
applicationName: 'SafeliteDotCom',
|
||||||
|
category: category,
|
||||||
|
action: action,
|
||||||
|
label: label,
|
||||||
|
value: value,
|
||||||
|
shouldUseSessionId: shouldUseSessionId
|
||||||
|
};
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetExperimentsByUserForGa.method,
|
method: endpoints.LogCustomEvent.method,
|
||||||
endpoint: `${endpoints.GetExperimentsByUserForGa.url}/${userId}`,
|
endpoint: endpoints.LogCustomEvent.url,
|
||||||
|
payload: payload,
|
||||||
|
logApiCall: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
GetExperimentsByUser(context, { userId }){
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
|
method: endpoints.GetExperimentsByUser.method,
|
||||||
|
endpoint: `${endpoints.GetExperimentsByUser.url}/${userId}`,
|
||||||
payload: {}
|
payload: {}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -617,7 +617,7 @@ describe("Actions", () => {
|
||||||
expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, "xxx-xxx-xxx");
|
expect(commit).toBeCalledWith(storeMutations.UPDATE_REFERRAL_CORRELATION_ID, "xxx-xxx-xxx");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logActivity action, should return nothing", async () => {
|
it("logPageView action, should return nothing", async () => {
|
||||||
|
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
|
|
@ -626,12 +626,26 @@ describe("Actions", () => {
|
||||||
event: "ENTRY",
|
event: "ENTRY",
|
||||||
}
|
}
|
||||||
|
|
||||||
var customEvent = [{
|
// Act
|
||||||
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
|
return Promise.resolve({ });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
const response = await actions.logPageView(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", pageEvent: pageEvent, shouldUseSessionId: true });
|
||||||
|
expect(response).toEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("logCustomEvent action, should return nothing", async () => {
|
||||||
|
|
||||||
|
// Arrange
|
||||||
|
const context = state;
|
||||||
|
var customEvent = {
|
||||||
category: "tstCat",
|
category: "tstCat",
|
||||||
action: "click",
|
action: "click",
|
||||||
label: "damage",
|
label: "damage",
|
||||||
value: "psych"
|
value: "psych"
|
||||||
}];
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
globalMethods.callHttpClient.mockImplementation(() => {
|
globalMethods.callHttpClient.mockImplementation(() => {
|
||||||
|
|
@ -639,7 +653,7 @@ describe("Actions", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
const response = await actions.logActivity(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", pageEvent: pageEvent, customEvent: customEvent, shouldUseSessionId: true });
|
const response = await actions.logCustomEvent(context, { userId: "userId", sessionKey: "sessionKey", pageName: "pageName", sessionId: "sessionId", customEvent: customEvent, shouldUseSessionId: true });
|
||||||
expect(response).toEqual({});
|
expect(response).toEqual({});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ process.env.VUE_APP_HERITAGE_FUNNEL =
|
||||||
"http://localhost:38000/default.aspx";
|
"http://localhost:38000/default.aspx";
|
||||||
process.env.VUE_APP_GOOGLE_PLACES_API_KEY =
|
process.env.VUE_APP_GOOGLE_PLACES_API_KEY =
|
||||||
"AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo";
|
"AIzaSyDptGCkOPgN2uWJOy4ou4M33phRD4MAoJo";
|
||||||
|
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
|
||||||
|
|
||||||
// GA & GTM
|
// GA & GTM
|
||||||
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+ '>m_auth=amlAYNhxUxuskQo7jmjadg>m_preview=env-38>m_cookies_win=x';f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-M6XCRH');";
|
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+ '>m_auth=amlAYNhxUxuskQo7jmjadg>m_preview=env-38>m_cookies_win=x';f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-M6XCRH');";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
process.env.VUE_APP_CONSUMER_CF_DISTRO = "__VUE_APP_CONSUMER_CF_DISTRO__";
|
process.env.VUE_APP_CONSUMER_CF_DISTRO = "__VUE_APP_CONSUMER_CF_DISTRO__";
|
||||||
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "__VUE_APP_GOOGLE_PLACES_API_KEY__";
|
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "__VUE_APP_GOOGLE_PLACES_API_KEY__";
|
||||||
process.env.VUE_APP_HERITAGE_FUNNEL = "__VUE_APP_HERITAGE_FUNNEL__";
|
process.env.VUE_APP_HERITAGE_FUNNEL = "__VUE_APP_HERITAGE_FUNNEL__";
|
||||||
|
process.env.VUE_APP_CURRENT_ENVIRONMENT = "__VUE_APP_CURRENT_ENVIRONMENT__";
|
||||||
|
|
||||||
// GA & GTM
|
// GA & GTM
|
||||||
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__";
|
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue