36 lines
1.4 KiB
JavaScript
36 lines
1.4 KiB
JavaScript
import { storeActions } from "@/constants/store-actions.js";
|
|
import store from "@/store";
|
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
|
import { experimentSettings } from "@/constants/experiments";
|
|
|
|
export default {
|
|
computed: {
|
|
IsEmailOptional() {
|
|
const emailOptional = this.getSettingValue(experimentSettings.IS_EMAIL_OPTIONAL);
|
|
return emailOptional === "true";
|
|
},
|
|
EmailValidationRules() {
|
|
return this.IsEmailOptional
|
|
? "email-address-format"
|
|
: "email-address-required|email-address-format";
|
|
},
|
|
},
|
|
methods: {
|
|
async navigateForwardWithSingleCarMatch() {
|
|
const pageName = this.$options?.name;
|
|
|
|
// If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions
|
|
if (!store.getters.applicationUser.savedSessionId) {
|
|
await saveSession({ pageNameToLog: pageName });
|
|
}
|
|
|
|
const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS, {
|
|
pageNameToLog: pageName,
|
|
});
|
|
const partsOrQuestions = result.data.partsOrQuestions;
|
|
|
|
vehicleQuestionsMixin.methods.navigateForward(partsOrQuestions, this);
|
|
},
|
|
},
|
|
};
|