Merge pull request #1171 from Safelite/feature/humphries/INSR-8878.1
Fixes for events on welcome-page and contact-details
This commit is contained in:
commit
56ab1ce835
5 changed files with 18 additions and 9 deletions
6
src/constants/contact-details.js
Normal file
6
src/constants/contact-details.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
const vehicleProtectedAnswers = Object.freeze({
|
||||||
|
YES: 'YesAnswer',
|
||||||
|
NO: 'NoAnswer'
|
||||||
|
});
|
||||||
|
|
||||||
|
export { vehicleProtectedAnswers };
|
||||||
|
|
@ -6,9 +6,10 @@ import contactDetails from '@/layouts/contact-details/contact-details.vue';
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import baseMixin from '@/mixins/base-mixin';
|
import baseMixin from '@/mixins/base-mixin';
|
||||||
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
import { getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js';
|
import { getRandomString, getRandomInt, getRandomEnum } from '@/helpers/data-generation.js';
|
||||||
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
import navigationScenarios from '@/router/router-constants/navigation-scenarios.js';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore } from '@/store/index.js';
|
||||||
|
import { vehicleProtectedAnswers } from '@/constants/contact-details';
|
||||||
|
|
||||||
/** @ignore */
|
/** @ignore */
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
|
|
@ -284,7 +285,7 @@ describe('contactDetails.vue', () => {
|
||||||
const state = getRandomString(2, 2);
|
const state = getRandomString(2, 2);
|
||||||
const zipCode = getRandomInt(10000, 99999).toString();
|
const zipCode = getRandomInt(10000, 99999).toString();
|
||||||
const notesForTechnician = getRandomString(1, 100);
|
const notesForTechnician = getRandomString(1, 100);
|
||||||
const isVehicleProtected = getRandomBoolean();
|
const isVehicleProtected = getRandomEnum(vehicleProtectedAnswers);
|
||||||
const storeData = {
|
const storeData = {
|
||||||
order: {
|
order: {
|
||||||
serviceLocation: {
|
serviceLocation: {
|
||||||
|
|
@ -372,7 +373,7 @@ describe('contactDetails.vue', () => {
|
||||||
const city = getRandomString(4, 20);
|
const city = getRandomString(4, 20);
|
||||||
const state = getRandomString(2, 2);
|
const state = getRandomString(2, 2);
|
||||||
const zipCode = getRandomInt(10000, 99999).toString();
|
const zipCode = getRandomInt(10000, 99999).toString();
|
||||||
const isVehicleProtected = getRandomBoolean().toString();
|
const isVehicleProtected = getRandomEnum(vehicleProtectedAnswers);
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
address,
|
address,
|
||||||
address2,
|
address2,
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ import { required } from '@/helpers/validation-rules';
|
||||||
import widgetFields from '@/constants/cms-widget-fields';
|
import widgetFields from '@/constants/cms-widget-fields';
|
||||||
import states from '@/constants/states';
|
import states from '@/constants/states';
|
||||||
import applicationConfig from '@/constants/application-config';
|
import applicationConfig from '@/constants/application-config';
|
||||||
|
import { vehicleProtectedAnswers } from '@/constants/contact-details';
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule('street-address-required', required(errorMessages.SERVICE_ADDRESS_REQUIRED));
|
defineRule('street-address-required', required(errorMessages.SERVICE_ADDRESS_REQUIRED));
|
||||||
|
|
@ -238,7 +239,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isVehicleProtected(newValue) {
|
isVehicleProtected(newValue) {
|
||||||
this.pushEventToGA("mobile_location", "is_vehicle_protected", newValue, true);
|
this.pushEventToGA("mobile_location", "covered_location", newValue === vehicleProtectedAnswers.YES ? "Yes" : "No", true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -259,7 +260,7 @@ export default {
|
||||||
address: this.address,
|
address: this.address,
|
||||||
address2: this.address2,
|
address2: this.address2,
|
||||||
city: this.city,
|
city: this.city,
|
||||||
isVehicleProtected: this.isVehicleProtected || 'false',
|
isVehicleProtected: this.isVehicleProtected || vehicleProtectedAnswers.NO,
|
||||||
provider
|
provider
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import { createTestingPinia } from '@pinia/testing';
|
||||||
import settleAllPromises from '@/helpers/layout-helper';
|
import settleAllPromises from '@/helpers/layout-helper';
|
||||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import baseMixin from '@/mixins/base-mixin';
|
import baseMixin from '@/mixins/base-mixin';
|
||||||
|
import { vehicleProtectedAnswers } from '@/constants/contact-details';
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const parts = {
|
const parts = {
|
||||||
|
|
@ -169,7 +170,7 @@ const defaultOrder = {
|
||||||
zipCode: 'zip',
|
zipCode: 'zip',
|
||||||
zipCodeCtu: 'zipCtu',
|
zipCodeCtu: 'zipCtu',
|
||||||
appointmentType: 'IN_SHOP',
|
appointmentType: 'IN_SHOP',
|
||||||
isVehicleProtected: true,
|
isVehicleProtected: vehicleProtectedAnswers.YES,
|
||||||
provider: {
|
provider: {
|
||||||
providerNumber: 2,
|
providerNumber: 2,
|
||||||
address: {
|
address: {
|
||||||
|
|
|
||||||
|
|
@ -256,10 +256,10 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.mainStore.applicationUser.firstHit) {
|
if (this.mainStore.applicationUser.firstHit) {
|
||||||
const isInfoPrefilled = !!(this.mainStore.order.policy.policyNumber
|
const isInfoPrefilled = !!(this.mainStore.order.policy.policyNumber
|
||||||
&& this.mainStore.order.policy.dateOfLoss
|
|| this.mainStore.order.policy.dateOfLoss
|
||||||
&& this.mainStore.order.policy.policyZipCode);
|
|| this.mainStore.order.policy.policyZipCode);
|
||||||
|
|
||||||
this.pushEventToGA("policy_info", "info_prefilled", isInfoPrefilled.toString(), true);
|
this.pushEventToGA("policy_info", "info_prefilled", isInfoPrefilled ? "Yes" : "No", true);
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const formRoot = this.$el;
|
const formRoot = this.$el;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue