diff --git a/src/constants/contact-details.js b/src/constants/contact-details.js new file mode 100644 index 00000000..e67fa086 --- /dev/null +++ b/src/constants/contact-details.js @@ -0,0 +1,6 @@ +const vehicleProtectedAnswers = Object.freeze({ + YES: 'YesAnswer', + NO: 'NoAnswer' +}); + +export { vehicleProtectedAnswers }; \ No newline at end of file diff --git a/src/layouts/contact-details/contact-details.spec.js b/src/layouts/contact-details/contact-details.spec.js index 6d1be304..f62fa211 100644 --- a/src/layouts/contact-details/contact-details.spec.js +++ b/src/layouts/contact-details/contact-details.spec.js @@ -6,9 +6,10 @@ import contactDetails from '@/layouts/contact-details/contact-details.vue'; // Supporting Files import baseMixin from '@/mixins/base-mixin'; import { getMountOptions } from '@/helpers/unit-test-helper.js'; -import { getRandomString, getRandomInt, getRandomBoolean } from '@/helpers/data-generation.js'; +import { getRandomString, getRandomInt, getRandomBoolean, getRandomStringFromList, getRandomEnum } from '@/helpers/data-generation.js'; import navigationScenarios from '@/router/router-constants/navigation-scenarios.js'; import { useMainStore } from '@/store/index.js'; +import { vehicleProtectedAnswers } from '@/constants/contact-details'; /** @ignore */ function setupMocks({ @@ -284,7 +285,7 @@ describe('contactDetails.vue', () => { const state = getRandomString(2, 2); const zipCode = getRandomInt(10000, 99999).toString(); const notesForTechnician = getRandomString(1, 100); - const isVehicleProtected = getRandomBoolean(); + const isVehicleProtected = getRandomEnum(vehicleProtectedAnswers); const storeData = { order: { serviceLocation: { @@ -372,7 +373,7 @@ describe('contactDetails.vue', () => { const city = getRandomString(4, 20); const state = getRandomString(2, 2); const zipCode = getRandomInt(10000, 99999).toString(); - const isVehicleProtected = getRandomBoolean().toString(); + const isVehicleProtected = getRandomEnum(vehicleProtectedAnswers); wrapper.setData({ address, address2, diff --git a/src/layouts/contact-details/contact-details.vue b/src/layouts/contact-details/contact-details.vue index a5c0c646..088b7997 100644 --- a/src/layouts/contact-details/contact-details.vue +++ b/src/layouts/contact-details/contact-details.vue @@ -134,6 +134,7 @@ import { required } from '@/helpers/validation-rules'; import widgetFields from '@/constants/cms-widget-fields'; import states from '@/constants/states'; import applicationConfig from '@/constants/application-config'; +import { vehicleProtectedAnswers } from '@/constants/contact-details'; // DEFINE VALIDATION RULES defineRule('street-address-required', required(errorMessages.SERVICE_ADDRESS_REQUIRED)); @@ -238,7 +239,7 @@ export default { } }, isVehicleProtected(newValue) { - this.pushEventToGA("mobile_location", "is_vehicle_protected", newValue, true); + this.pushEventToGA("mobile_location", "covered_location", newValue === vehicleProtectedAnswers.YES ? "Yes" : "No", true); } }, methods: { @@ -259,7 +260,7 @@ export default { address: this.address, address2: this.address2, city: this.city, - isVehicleProtected: this.isVehicleProtected || 'false', + isVehicleProtected: this.isVehicleProtected, provider }); diff --git a/src/layouts/payment-page/payment-page.spec.js b/src/layouts/payment-page/payment-page.spec.js index 89293dd4..0b5b20ef 100644 --- a/src/layouts/payment-page/payment-page.spec.js +++ b/src/layouts/payment-page/payment-page.spec.js @@ -11,6 +11,7 @@ import { createTestingPinia } from '@pinia/testing'; import settleAllPromises from '@/helpers/layout-helper'; import { fetchCmsContentForPage } from '@/helpers/cms-content-helper'; import baseMixin from '@/mixins/base-mixin'; +import { vehicleProtectedAnswers } from '@/constants/contact-details'; // Constants const parts = { @@ -169,7 +170,7 @@ const defaultOrder = { zipCode: 'zip', zipCodeCtu: 'zipCtu', appointmentType: 'IN_SHOP', - isVehicleProtected: true, + isVehicleProtected: vehicleProtectedAnswers.YES, provider: { providerNumber: 2, address: { diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index 2b80ca23..1bb70de7 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -256,10 +256,10 @@ export default { mounted() { if (this.mainStore.applicationUser.firstHit) { const isInfoPrefilled = !!(this.mainStore.order.policy.policyNumber - && this.mainStore.order.policy.dateOfLoss - && this.mainStore.order.policy.policyZipCode); + || this.mainStore.order.policy.dateOfLoss + || 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(() => { const formRoot = this.$el;