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/constants/endpoints.js b/src/constants/endpoints.js index aaf221bd2..08f429b5e 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -54,6 +54,10 @@ const endpoints = { url: "/vehicle/api/v1/vehicle/lookup-vin-by-address", method: "POST", }, + LookupVinByImage: { + url: "/vehicle/api/v1/vehicle/vins-by-image", + method: "POST", + }, IsVinByAddressPermissible: { url: "/vehicle/api/v1/vehicle/is-vin-by-address-permissible", method: "GET", @@ -86,6 +90,10 @@ const endpoints = { url: "/parts/api/v1/parts/supporting-items", method: "POST", }, + GetProviderLocations: { + url: "/location/api/v1/location/providers", + method: "GET", + }, GetCapabilityQuestions: { url: "/parts/api/v1/parts/capability-questions", method: "GET", diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 3fc664413..db15e9854 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -20,6 +20,7 @@ const storeActions = { LOOKUP_VEHICLE_BY_VIN: "lookupVehicleByVin", LOOKUP_VIN_BY_PLATE: "lookupVinByPlate", LOOKUP_VIN_BY_ADDRESS: "lookupVinByAddress", + LOOKUP_VIN_BY_IMAGE: "lookupVinByImage", GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions", GET_PARTS: "getParts", GET_WIPERS: "getWipers", @@ -30,6 +31,7 @@ const storeActions = { GET_MOLDING_QUESTIONS: "getMoldingQuestions", GET_MOBILE_FEE_PART: "getMobileFeePart", GET_SERVICEABILITY_DETAILS: "getServiceabilityDetails", + GET_PROVIDER_LOCATIONS: "getProviderLocations", SAVE_SESSION: "saveSession", LOAD_SESSION: "loadSession", UPDATE_STORE_WITH_SAVE_SESSION_RESPONSE: "updateStoreWithSaveSessionResponse", diff --git a/src/digital-components/button-question/button-question.spec.js b/src/digital-components/button-question/button-question.spec.js index e9e1d70a4..ce8d87fab 100644 --- a/src/digital-components/button-question/button-question.spec.js +++ b/src/digital-components/button-question/button-question.spec.js @@ -1,6 +1,9 @@ import { shallowMount, mount } from "@vue/test-utils"; import buttonQuestion from "./button-question"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import crypto from "crypto"; + +global.crypto = crypto; describe("buttonQuestion.vue", () => { it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => { diff --git a/src/digital-components/button-question/button-question.vue b/src/digital-components/button-question/button-question.vue index 44a427275..e98ef2901 100644 --- a/src/digital-components/button-question/button-question.vue +++ b/src/digital-components/button-question/button-question.vue @@ -86,7 +86,8 @@ import listButton from "@/ux-components/list-button/list-button"; import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-button-horizontal"; import listCard from "@/ux-components/list-card/list-card"; import radio from "@/ux-components/radio/radio"; -import { ErrorMessage } from "vee-validate"; +import { useField, ErrorMessage } from "vee-validate"; +import { queryStrings } from "@/constants/query-strings"; export default { name: "buttonQuestion", @@ -128,6 +129,34 @@ export default { valueToLogType: String, additionalButtonStyling: String, isSmallQuestionText: Boolean, + availability: String, + customButtonQuestionId: String, + logDisplayedValuesEvent: { + type: Boolean, + default: false, + }, + }, + setup(props) { + const propsClone = Object.assign({}, props); + const modelValue = propsClone.modelValue; + + const fieldOptions = { + value: modelValue, + initialValue: modelValue, + }; + + const { errorMessage, handleBlur, handleChange, meta, validate, errors, resetField } = + useField(props.groupName, props.validationRules, fieldOptions); + + return { + errorMessage, + handleBlur, + handleChange, + validate, + meta, + errors, + resetField, + }; }, beforeMount() { if (this.buttonTypeObject) { @@ -226,6 +255,36 @@ export default { this.$emit(`buttonEvent.${eventName}`, event.args); }, }, + watch: { + modelValue(newValue) { + this.resetField({ + value: newValue, + }); + }, + 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) => { + if (item.Name) { + eventLabel += item.Name + ","; + } + if (item.buttonLabel) { + eventLabel += item.buttonLabel + ","; + } + }); + + 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, diff --git a/src/digital-components/dropdown-question/dropdown-question.vue b/src/digital-components/dropdown-question/dropdown-question.vue index e122837c4..5c32b298c 100644 --- a/src/digital-components/dropdown-question/dropdown-question.vue +++ b/src/digital-components/dropdown-question/dropdown-question.vue @@ -3,15 +3,15 @@ class="dropdown-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">