diff --git a/src/constants/analytics.js b/src/constants/analytics.js index eed7da2fe..b5b24660d 100644 --- a/src/constants/analytics.js +++ b/src/constants/analytics.js @@ -19,6 +19,7 @@ const GaActions = { CLICKED: "Clicked", VIF: "vif", SUBMITTED: "Submitted", + DISPLAYED: "Displayed", }; const GaLabels = { diff --git a/src/digital-components/button-question/button-question.vue b/src/digital-components/button-question/button-question.vue index ec7b165a0..d1fe5b434 100644 --- a/src/digital-components/button-question/button-question.vue +++ b/src/digital-components/button-question/button-question.vue @@ -87,6 +87,7 @@ import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-bu import listCard from "@/ux-components/list-card/list-card"; import radio from "@/ux-components/radio/radio"; import { useField, ErrorMessage } from "vee-validate"; +import { queryStrings } from "@/constants/query-strings"; export default { name: "buttonQuestion", @@ -129,6 +130,10 @@ export default { additionalButtonStyling: String, isSmallQuestionText: Boolean, customButtonQuestionId: String, + logDisplayedValuesEvent: { + type: Boolean, + default: false, + }, }, setup(props) { const propsClone = Object.assign({}, props); @@ -161,7 +166,7 @@ export default { return { lastValuePushedToGa: null, }; - }, + }, computed: { getFieldSetClasses() { const baseClasses = this.isOverflowScrollable @@ -253,7 +258,25 @@ export default { modelValue() { this.resetField(); }, - }, + answers() { + //once we get the answers to display from parent, see if we need a GA event to log what we showed + if (this.logDisplayedValuesEvent && this.answers.length > 0) { + var eventLabel = ""; + //build comma separated list of all items in button list that we are going to display on page + this.answers.forEach((item) => { + eventLabel += item.Name + ","; + }); + + eventLabel = eventLabel.slice(0, -1); //remove the last comma + this.pushEventToGA( + this.$route.query[queryStrings.FMG_PAGE], + this.GaActions.DISPLAYED, + eventLabel, + true + ); + } + }, + }, components: { listButton, listButtonHorizontal, @@ -289,7 +312,7 @@ export default { margin-bottom: 1rem; font-size: 1rem; line-height: 1.625rem; - + & > span { text-align: center; } diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 22e312939..727825d9d 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -1,6 +1,7 @@ import store from "@/store"; import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; +import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected"; export function getDamageString() { // If it's a repair it's always a windshield. @@ -45,6 +46,14 @@ export function getIsWindshieldOnly() { return returnString; } +export function includesWindshieldReplacement() { + const windshieldMatches = + store.getters.order.damage.glassToReplace?.filter( + (glassToReplace) => glassToReplace.glassLocation === glassLocations.WINDSHIELD + ) ?? []; + return windshieldMatches.length > 0; +} + export async function isGlassAvailableForCarId(carId) { const newGlassOptions = await baseMixin.methods.dispatchStoreAction( storeActions.GET_DAMAGE_OPTIONS, diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 0e756a8a4..913fbcb1b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -7,6 +7,7 @@ import { storeActions } from "@/constants/store-actions.js"; import { settleAllPromises } from "@/helpers/layout-helper"; import experimentMixin from "@/mixins/experiment-mixin"; import { experimentSettings } from "@/constants/experiments"; +import { includesWindshieldReplacement } from "@/helpers/damage-helper"; import store from "@/store"; import router from "@/router"; @@ -73,6 +74,7 @@ export async function skipVinLookup() { return ( store.getters.damage.isRepair || isVinOptionalVehicle || + !includesWindshieldReplacement() || experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true") ); } @@ -85,6 +87,7 @@ export async function skipVinLookupNotRepair() { return ( !store.getters.damage.isRepair && (isVinOptionalVehicle || + !includesWindshieldReplacement() || experimentMixin.methods.hasSettingEqualTo( experimentSettings.SUPPRESS_VIN_CAPTURE, "true" diff --git a/src/helpers/heritage-integration/navigation-helper.spec.js b/src/helpers/heritage-integration/navigation-helper.spec.js index 67a5055c8..d08ce92ec 100644 --- a/src/helpers/heritage-integration/navigation-helper.spec.js +++ b/src/helpers/heritage-integration/navigation-helper.spec.js @@ -135,7 +135,7 @@ describe("getPageToRouteExistingOrderTo", () => { expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE); }); - test("user has YMMS and no vehicle questions > should return vin-lookup", async () => { + test("user has YMMS and no vehicle questions > should return estimate", async () => { // Arrange const toRoute = { query: {}, @@ -172,7 +172,7 @@ describe("getPageToRouteExistingOrderTo", () => { const result = await getPageToRouteExistingOrderTo(toRoute, false); //Assert - expect(result).toBe(fmgPageValues.VIN_LOOKUP); + expect(result).toBe(fmgPageValues.ESTIMATE); }); test("user has YMMS but no questions or carId > should return estimate", async () => { diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js index 4a0a3f434..462287851 100644 --- a/src/layouts/estimate/estimate.spec.js +++ b/src/layouts/estimate/estimate.spec.js @@ -101,6 +101,9 @@ describe("estimate.vue", () => { //Arrange const { wrapper } = setupMocks({}); + delete window.location; + window.location = { search: "?fmgPage=estimate&zipcode=43015" }; + //Act estimate.beforeRouteEnter.call( wrapper.vm, diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 0671c1015..1ca0c9d48 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -18,7 +18,8 @@ buttonTypeString="listButton" v-model="selectedVinLookupMethod" isRequired - validationRules="option-required" /> + validationRules="option-required" + :logDisplayedValuesEvent="true" />