Merge branch 'release/2023.05.04' into rlsmerge/2023.04.05-to-develop-04.25

This commit is contained in:
CarlNation 2023-04-25 10:42:54 -04:00
commit 0a6593c597
9 changed files with 107 additions and 33 deletions

View file

@ -19,6 +19,7 @@ const GaActions = {
CLICKED: "Clicked", CLICKED: "Clicked",
VIF: "vif", VIF: "vif",
SUBMITTED: "Submitted", SUBMITTED: "Submitted",
DISPLAYED: "Displayed",
}; };
const GaLabels = { const GaLabels = {

View file

@ -87,6 +87,7 @@ import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-bu
import listCard from "@/ux-components/list-card/list-card"; import listCard from "@/ux-components/list-card/list-card";
import radio from "@/ux-components/radio/radio"; import radio from "@/ux-components/radio/radio";
import { useField, ErrorMessage } from "vee-validate"; import { useField, ErrorMessage } from "vee-validate";
import { queryStrings } from "@/constants/query-strings";
export default { export default {
name: "buttonQuestion", name: "buttonQuestion",
@ -129,6 +130,10 @@ export default {
additionalButtonStyling: String, additionalButtonStyling: String,
isSmallQuestionText: Boolean, isSmallQuestionText: Boolean,
customButtonQuestionId: String, customButtonQuestionId: String,
logDisplayedValuesEvent: {
type: Boolean,
default: false,
},
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props); const propsClone = Object.assign({}, props);
@ -161,7 +166,7 @@ export default {
return { return {
lastValuePushedToGa: null, lastValuePushedToGa: null,
}; };
}, },
computed: { computed: {
getFieldSetClasses() { getFieldSetClasses() {
const baseClasses = this.isOverflowScrollable const baseClasses = this.isOverflowScrollable
@ -253,7 +258,25 @@ export default {
modelValue() { modelValue() {
this.resetField(); 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: { components: {
listButton, listButton,
listButtonHorizontal, listButtonHorizontal,
@ -289,7 +312,7 @@ export default {
margin-bottom: 1rem; margin-bottom: 1rem;
font-size: 1rem; font-size: 1rem;
line-height: 1.625rem; line-height: 1.625rem;
& > span { & > span {
text-align: center; text-align: center;
} }

View file

@ -1,6 +1,7 @@
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 { storeActions } from "@/constants/store-actions";
import { damageLocationsSelected as glassLocations } from "@/constants/damage-locations-selected";
export function getDamageString() { export function getDamageString() {
// If it's a repair it's always a windshield. // If it's a repair it's always a windshield.
@ -45,6 +46,14 @@ export function getIsWindshieldOnly() {
return returnString; 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) { export async function isGlassAvailableForCarId(carId) {
const newGlassOptions = await baseMixin.methods.dispatchStoreAction( const newGlassOptions = await baseMixin.methods.dispatchStoreAction(
storeActions.GET_DAMAGE_OPTIONS, storeActions.GET_DAMAGE_OPTIONS,

View file

@ -7,6 +7,7 @@ import { storeActions } from "@/constants/store-actions.js";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import experimentMixin from "@/mixins/experiment-mixin"; import experimentMixin from "@/mixins/experiment-mixin";
import { experimentSettings } from "@/constants/experiments"; import { experimentSettings } from "@/constants/experiments";
import { includesWindshieldReplacement } from "@/helpers/damage-helper";
import store from "@/store"; import store from "@/store";
import router from "@/router"; import router from "@/router";
@ -73,6 +74,7 @@ export async function skipVinLookup() {
return ( return (
store.getters.damage.isRepair || store.getters.damage.isRepair ||
isVinOptionalVehicle || isVinOptionalVehicle ||
!includesWindshieldReplacement() ||
experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true") experimentMixin.methods.hasSettingEqualTo(experimentSettings.SUPPRESS_VIN_CAPTURE, "true")
); );
} }
@ -85,6 +87,7 @@ export async function skipVinLookupNotRepair() {
return ( return (
!store.getters.damage.isRepair && !store.getters.damage.isRepair &&
(isVinOptionalVehicle || (isVinOptionalVehicle ||
!includesWindshieldReplacement() ||
experimentMixin.methods.hasSettingEqualTo( experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SUPPRESS_VIN_CAPTURE, experimentSettings.SUPPRESS_VIN_CAPTURE,
"true" "true"

View file

@ -135,7 +135,7 @@ describe("getPageToRouteExistingOrderTo", () => {
expect(result).toBe(fmgPageValues.VEHICLE_DAMAGE); 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 // Arrange
const toRoute = { const toRoute = {
query: {}, query: {},
@ -172,7 +172,7 @@ describe("getPageToRouteExistingOrderTo", () => {
const result = await getPageToRouteExistingOrderTo(toRoute, false); const result = await getPageToRouteExistingOrderTo(toRoute, false);
//Assert //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 () => { test("user has YMMS but no questions or carId > should return estimate", async () => {

View file

@ -101,6 +101,9 @@ describe("estimate.vue", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
delete window.location;
window.location = { search: "?fmgPage=estimate&zipcode=43015" };
//Act //Act
estimate.beforeRouteEnter.call( estimate.beforeRouteEnter.call(
wrapper.vm, wrapper.vm,

View file

@ -18,7 +18,8 @@
buttonTypeString="listButton" buttonTypeString="listButton"
v-model="selectedVinLookupMethod" v-model="selectedVinLookupMethod"
isRequired isRequired
validationRules="option-required" /> validationRules="option-required"
:logDisplayedValuesEvent="true" />
</div> </div>
<div v-else> <div v-else>
<alert <alert
@ -147,11 +148,17 @@ export default {
const queryString = window.location.search; const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const hasZip = urlParams.has(queryStrings.ZIP_CODE); const lowerCaseParams = new URLSearchParams();
const zip = urlParams.get(queryStrings.ZIP_CODE); for (const [name, value] of urlParams) {
lowerCaseParams.append(name.toLowerCase(), value);
}
const zip = lowerCaseParams.get(queryStrings.ZIP_CODE)
? lowerCaseParams.get(queryStrings.ZIP_CODE)
: store.getters.order.serviceLocation.zipCode;
var vinByAddressPromise; var vinByAddressPromise;
if (hasZip) { if (zip) {
vinByAddressPromise = baseMixin.methods.dispatchStoreAction( vinByAddressPromise = baseMixin.methods.dispatchStoreAction(
storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE, storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE,
zip, zip,
@ -191,7 +198,7 @@ export default {
} }
} }
if (zip && resultMap.vinByAddress === false) { if (!zip || resultMap.vinByAddress === false) {
var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex( var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex(
(answer) => answer.Name === "HomeAddress" (answer) => answer.Name === "HomeAddress"
); );
@ -199,6 +206,7 @@ export default {
resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1); resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1);
} }
} }
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
}); });
}, },

View file

@ -146,18 +146,18 @@ export default {
false false
); );
if (response.data) { if (response?.data) {
if (response.data.sessionKey && skey === 0) { if (response?.data.sessionKey && skey === 0) {
setCookieProperties( setCookieProperties(
{ [cookieNames.SESSION_KEY]: response.data.sessionKey }, { [cookieNames.SESSION_KEY]: response?.data.sessionKey },
{ {
useDefaultFunnelCookieAttributes: false, useDefaultFunnelCookieAttributes: false,
} }
); );
} }
if (response.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") { if (response?.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") {
setCookieProperties( setCookieProperties(
{ [cookieNames.SESSION_ID]: response.data.sessionId }, { [cookieNames.SESSION_ID]: response?.data.sessionId },
{ {
maxAge: 60 * 30, // 30 minutes maxAge: 60 * 30, // 30 minutes
} }

View file

@ -727,12 +727,21 @@ export const actions = {
experimentsForUser: experimentsForUser, experimentsForUser: experimentsForUser,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.LogPageView.method, .callHttpClient({
endpoint: endpoints.LogPageView.url, method: endpoints.LogPageView.method,
payload: payload, endpoint: endpoints.LogPageView.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
logCustomEvent( logCustomEvent(
context, context,
@ -763,12 +772,21 @@ export const actions = {
experimentsForUser: experimentsForUser, experimentsForUser: experimentsForUser,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.LogCustomEvent.method, .callHttpClient({
endpoint: endpoints.LogCustomEvent.url, method: endpoints.LogCustomEvent.method,
payload: payload, endpoint: endpoints.LogCustomEvent.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
initializeSession(context, { userId, sessionId, userAgent, referrer }) { initializeSession(context, { userId, sessionId, userAgent, referrer }) {
var payload = { var payload = {
@ -782,12 +800,21 @@ export const actions = {
referrer: referrer, referrer: referrer,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.InitializeSession.method, .callHttpClient({
endpoint: endpoints.InitializeSession.url, method: endpoints.InitializeSession.method,
payload: payload, endpoint: endpoints.InitializeSession.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
// Misc Actions // Misc Actions