diff --git a/.prettierrc b/.prettierrc index f1c8e7129..21209f49e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,4 @@ { - "tabWidth": 2, + "tabWidth": 4, "bracketSameLine": true } \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index e09e04c99..6693b2955 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,36 +1,57 @@ diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 8d3abb287..7099e6227 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -125,7 +125,8 @@ export default { data() { return { primaryValue: "", - lastFocusedInputGroup: "", + // lastFocusedInputGroup: "", + lastPushedGaEventValue: null, }; }, computed: { @@ -197,6 +198,9 @@ export default { }) ); }, + isValueSelectedOnClick() { + return this.isMultiSelect || this.selectingInitiatesLoad; + }, }, methods: { formatString(str) { @@ -222,31 +226,46 @@ export default { }, handleAnswerChange(primaryAnswerValue) { this.primaryValue = primaryAnswerValue; - console.log("hAC: ", primaryAnswerValue) + + this.pushClickEventToGA(null, primaryAnswerValue); + this.$emit("buttonQuestionChange", primaryAnswerValue); this.$emit("update:modelValue", primaryAnswerValue); }, pushClickEventToGA(e, value) { - this.pushEventToGA( - this.$route.query[queryStrings.FMG_PAGE], - this.GaActions.CLICKED, - value?.toString() ?? this.primaryValue?.toString(), - true, - this.valueToLogType - ); + const valueToPushToGa = + value?.toString() ?? this.primaryValue?.toString(); + console.log({ + valueToPushToGa, + lastPushedGaEventValue: this.lastPushedGaEventValue, + }); + if (valueToPushToGa !== this.lastPushedGaEventValue) { + this.lastPushedGaEventValue = valueToPushToGa; + this.pushEventToGA( + this.$route.query[queryStrings.FMG_PAGE], + this.GaActions.CLICKED, + valueToPushToGa, + true, + this.valueToLogType + ); + } }, - handleFocus() { - this.$root.handleFocus({ - groupName: this.groupName, - value: this.primaryValue - }) + onFocusCallbackForRoot() { + if (!this.isValueSelectedOnClick) { + this.pushClickEventToGA(); + } }, - handleBlur() { - this.$root.handleBlur({ + handleFocus(e) { + this.$root.handleInputFocus({ groupName: this.groupName, - value: this.primaryValue - }) - } + }); + }, + handleBlur(e) { + this.$root.handleInputBlur({ + groupName: this.groupName, + onFocusCallback: this.onFocusCallbackForRoot, + }); + }, }, components: { listButton, diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 9e99307ee..d6a8ced7e 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -61,39 +61,39 @@ export default { state: serviceZipValidationResponse.data.state, }; }, - pushRadioClickEventIfNecessary() { - const { - firedGaClickEventValues, - currentlySelectedValues, - lastFocusedInputGroup, - wasLastFocusedInputMultiselect, - } = this.$store.getters.gaClickInformation; + // pushRadioClickEventIfNecessary() { + // const { + // firedGaClickEventValues, + // currentlySelectedValues, + // lastFocusedInputGroup, + // wasLastFocusedInputMultiselect, + // } = this.$store.getters.gaClickInformation; - // Keyboard navigation - if ( - !wasLastFocusedInputMultiselect && - currentlySelectedValues[lastFocusedInputGroup] && - firedGaClickEventValues[lastFocusedInputGroup] != - currentlySelectedValues[lastFocusedInputGroup] - ) { - const value = - currentlySelectedValues[lastFocusedInputGroup]?.toString(); - // this.dispatchStoreAction( - // gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES, - // { - // groupName: lastFocusedInputGroup, - // value: value, - // } - // ); + // // Keyboard navigation + // if ( + // !wasLastFocusedInputMultiselect && + // currentlySelectedValues[lastFocusedInputGroup] && + // firedGaClickEventValues[lastFocusedInputGroup] != + // currentlySelectedValues[lastFocusedInputGroup] + // ) { + // const value = + // currentlySelectedValues[lastFocusedInputGroup]?.toString(); + // // this.dispatchStoreAction( + // // gaStoreActions.UPDATE_FIRED_GA_CLICK_EVENT_VALUES, + // // { + // // groupName: lastFocusedInputGroup, + // // value: value, + // // } + // // ); - this.pushEventToGA( - this.$route.query[queryStrings.FMG_PAGE], - this.GaActions.CLICKED, - value, - true - ); - } - }, + // this.pushEventToGA( + // this.$route.query[queryStrings.FMG_PAGE], + // this.GaActions.CLICKED, + // value, + // true + // ); + // } + // }, }, computed: { storeActions() {