Merge branch 'develop' into feature/CSR-1410
This commit is contained in:
commit
75390dbfd4
11 changed files with 587 additions and 62 deletions
|
|
@ -8,4 +8,9 @@ const PREMIUM_TIME_SLOT_ID_FLAG = "-premium";
|
||||||
|
|
||||||
const PREMIUM_FEE_PART_TYPE = "EARLY BIRD";
|
const PREMIUM_FEE_PART_TYPE = "EARLY BIRD";
|
||||||
|
|
||||||
export { AppointmentTypeStrings, PREMIUM_TIME_SLOT_ID_FLAG, PREMIUM_FEE_PART_TYPE };
|
const RouteCodeFlags = {
|
||||||
|
ALL_DAY_DROP_OFF: "ALL DAY DROP OFF",
|
||||||
|
OVERNIGHT_DROP_OFF: "OVERNIGHT DROP OFF",
|
||||||
|
};
|
||||||
|
|
||||||
|
export { AppointmentTypeStrings, PREMIUM_TIME_SLOT_ID_FLAG, PREMIUM_FEE_PART_TYPE, RouteCodeFlags };
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ const storeActions = {
|
||||||
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
||||||
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
||||||
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
||||||
|
RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES: "resetServiceLocationAndDependencies",
|
||||||
RESET_STATE: "resetState",
|
RESET_STATE: "resetState",
|
||||||
|
|
||||||
// SAVE COMPONENT STATE
|
// SAVE COMPONENT STATE
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,19 @@
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
v-on="{ 'show.bs.modal': show, 'hide.bs.modal': hide }"
|
v-on="{ 'show.bs.modal': show, 'hide.bs.modal': hide }"
|
||||||
:style="`height: calc(100% - ${currentFooterAndHeaderHeight}px);`">
|
:style="`height: calc(100% - ${currentFooterAndHeaderHeight}px);`">
|
||||||
|
<div class="menu-modal-container">
|
||||||
|
<button
|
||||||
|
class="menu-button"
|
||||||
|
type="button"
|
||||||
|
:class="[isActive ? 'active' : '']"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#footerModal"
|
||||||
|
aria-label="Hamburger Menu (modal window)">
|
||||||
|
<div class="bar1"></div>
|
||||||
|
<div class="bar2"></div>
|
||||||
|
<div class="bar3"></div>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="modal-dialog modal-fullscreen">
|
<div class="modal-dialog modal-fullscreen">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header visually-hidden">
|
<div class="modal-header visually-hidden">
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,19 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="text-container slide">
|
<div class="text-container slide">
|
||||||
<p>
|
<p>
|
||||||
Finding shops near you
|
Tidying up the shop
|
||||||
<span class="dot-1">.</span>
|
<span class="dot-1">.</span>
|
||||||
<span class="dot-2">.</span>
|
<span class="dot-2">.</span>
|
||||||
<span class="dot-3">.</span>
|
<span class="dot-3">.</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Looking for dates
|
Getting all the glass shined up
|
||||||
<span class="dot-1">.</span>
|
<span class="dot-1">.</span>
|
||||||
<span class="dot-2">.</span>
|
<span class="dot-2">.</span>
|
||||||
<span class="dot-3">.</span>
|
<span class="dot-3">.</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Searching for times
|
Planning your new view of the road
|
||||||
<span class="dot-1">.</span>
|
<span class="dot-1">.</span>
|
||||||
<span class="dot-2">.</span>
|
<span class="dot-2">.</span>
|
||||||
<span class="dot-3">.</span>
|
<span class="dot-3">.</span>
|
||||||
|
|
@ -164,19 +164,19 @@ export default {
|
||||||
transform: translateX(-600px);
|
transform: translateX(-600px);
|
||||||
}
|
}
|
||||||
55% {
|
55% {
|
||||||
transform: translateX(-1110px);
|
transform: translateX(-1195px);
|
||||||
}
|
}
|
||||||
66% {
|
66% {
|
||||||
transform: translateX(-1110px);
|
transform: translateX(-1195px);
|
||||||
}
|
}
|
||||||
77% {
|
77% {
|
||||||
transform: translateX(-1600px);
|
transform: translateX(-1750px);
|
||||||
}
|
}
|
||||||
88% {
|
88% {
|
||||||
transform: translateX(-1600px);
|
transform: translateX(-1750px);
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
transform: translateX(-2050px);
|
transform: translateX(-2200px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import analyticsMixIn from "@/mixins/analytics-mixin.js";
|
import analyticsMixIn from "@/mixins/analytics-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
import { applicationConfig } from "@/constants/application-config.js";
|
import { applicationConfig } from "@/constants/application-config.js";
|
||||||
import { GaCategories, GaActions, GaLabels } from "@/constants/analytics";
|
import { GaCategories, GaActions, GaLabels } from "@/constants/analytics";
|
||||||
import { headerKeys } from "@/constants/header-keys";
|
import { headerKeys } from "@/constants/header-keys";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
callHttpClient({ method, endpoint, payload, logApiCall = true, isFormData = false }) {
|
callHttpClient({
|
||||||
|
method,
|
||||||
|
endpoint,
|
||||||
|
payload,
|
||||||
|
logApiCall = true,
|
||||||
|
isFormData = false,
|
||||||
|
additionalSuccessEventDataHandler,
|
||||||
|
}) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO;
|
const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO;
|
||||||
let payloadAndAnalyticsData = {};
|
let payloadAndAnalyticsData = {};
|
||||||
|
|
@ -31,10 +39,16 @@ export default {
|
||||||
}).then(
|
}).then(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (logApiCall) {
|
if (logApiCall) {
|
||||||
|
let additionalEventData = "";
|
||||||
|
if (additionalSuccessEventDataHandler) {
|
||||||
|
additionalEventData = "_" + additionalSuccessEventDataHandler(response);
|
||||||
|
}
|
||||||
|
const pageName = analyticsMixIn.methods.getPageName();
|
||||||
|
const nextPageName = router.getNextPage() || pageName;
|
||||||
analyticsMixIn.methods.pushEventToGA(
|
analyticsMixIn.methods.pushEventToGA(
|
||||||
GaCategories.API_RESPONSE,
|
GaCategories.API_RESPONSE,
|
||||||
GaActions.RESULT,
|
`${nextPageName}_${endpoint}`,
|
||||||
`${GaLabels.SUCCESS}_${endpoint}`,
|
`${GaLabels.SUCCESS}${additionalEventData}`,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
mobileCmsWidgetName="MobileTimeSlotModal"
|
mobileCmsWidgetName="MobileTimeSlotModal"
|
||||||
dropoffCmsWidgetName="DropOffTimeSlotModal"
|
dropoffCmsWidgetName="DropOffTimeSlotModal"
|
||||||
sameDayDropOffCmsWidgetName="SameDayDropOffTimeSlotModal"
|
sameDayDropOffCmsWidgetName="SameDayDropOffTimeSlotModal"
|
||||||
|
overnightDropOffCmsWidgetName="OvernightDropOffTimeSlotModal"
|
||||||
v-model="selectedTimeSlotData"
|
v-model="selectedTimeSlotData"
|
||||||
@time-slot-modal-closed="timeSlotModalClosed"
|
@time-slot-modal-closed="timeSlotModalClosed"
|
||||||
:appointmentType="appointmentType"
|
:appointmentType="appointmentType"
|
||||||
|
|
@ -50,7 +51,6 @@ import funnelFooter from "@/fmg-components/funnel-footer/funnel-footer";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import { Form, defineRule } from "vee-validate";
|
import { Form, defineRule } from "vee-validate";
|
||||||
import { processIfStatements } from "@/helpers/cms-content-helper";
|
|
||||||
import datePicker from "@/digital-components/date-picker/date-picker";
|
import datePicker from "@/digital-components/date-picker/date-picker";
|
||||||
import locationAlerts from "@/layouts/schedule/location-alerts/location-alerts";
|
import locationAlerts from "@/layouts/schedule/location-alerts/location-alerts";
|
||||||
import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question";
|
import timeSlotModalQuestion from "./time-slot-modal-question/time-slot-modal-question";
|
||||||
|
|
@ -62,12 +62,7 @@ import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
import {
|
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
||||||
doesCopyContainRouterLink,
|
|
||||||
splitCopyOnCMSPlaceHolder,
|
|
||||||
getRouterLinkRouteFromCopy,
|
|
||||||
getRouterLinkDisplayTextFromCopy,
|
|
||||||
} from "@/helpers/cms-content-helper";
|
|
||||||
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants";
|
import { AppointmentTypeStrings, PREMIUM_FEE_PART_TYPE } from "@/constants/schedule-constants";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
|
|
@ -225,11 +220,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doesCopyContainRouterLink,
|
|
||||||
splitCopyOnCMSPlaceHolder,
|
splitCopyOnCMSPlaceHolder,
|
||||||
getRouterLinkRouteFromCopy,
|
|
||||||
getRouterLinkDisplayTextFromCopy,
|
|
||||||
processIfStatements,
|
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
const serviceLocation = store.getters.order.serviceLocation;
|
const serviceLocation = store.getters.order.serviceLocation;
|
||||||
const serviceLocationPreReqs =
|
const serviceLocationPreReqs =
|
||||||
|
|
@ -268,8 +259,8 @@ export default {
|
||||||
getTimeSlotObjectFromTimeSlotId(timeSlotId) {
|
getTimeSlotObjectFromTimeSlotId(timeSlotId) {
|
||||||
const timeSlots = this.selectableDatesData.days.find(
|
const timeSlots = this.selectableDatesData.days.find(
|
||||||
(selectableDate) => selectableDate.date === this.selectedDate
|
(selectableDate) => selectableDate.date === this.selectedDate
|
||||||
).timeSlots;
|
)?.timeSlots;
|
||||||
return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId);
|
if (timeSlots) return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId);
|
||||||
},
|
},
|
||||||
getSelectedDate() {
|
getSelectedDate() {
|
||||||
return store.getters.order.schedule.date;
|
return store.getters.order.schedule.date;
|
||||||
|
|
@ -285,7 +276,7 @@ export default {
|
||||||
},
|
},
|
||||||
updateFooterButtonText(timeSlotData) {
|
updateFooterButtonText(timeSlotData) {
|
||||||
let funnelFooterButtonText;
|
let funnelFooterButtonText;
|
||||||
if (!timeSlotData.id) {
|
if (!timeSlotData.id || !this.appointmentDateAndTime) {
|
||||||
funnelFooterButtonText = "Continue";
|
funnelFooterButtonText = "Continue";
|
||||||
} else {
|
} else {
|
||||||
funnelFooterButtonText =
|
funnelFooterButtonText =
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@
|
||||||
v-if="supplementalInformationBlock"
|
v-if="supplementalInformationBlock"
|
||||||
v-html="supplementalInformationBlock"></div>
|
v-html="supplementalInformationBlock"></div>
|
||||||
<textBlock
|
<textBlock
|
||||||
v-show="shouldShowDropoffDisclaimerText"
|
v-show="disclaimerTextBlockCopy"
|
||||||
:customText="dropoffDisclaimerText"
|
:customText="disclaimerTextBlockCopy"
|
||||||
justifyText="left"
|
justifyText="left"
|
||||||
typeStyle="caption"
|
typeStyle="caption"
|
||||||
class="mb-2 mt-4" />
|
class="mb-2" />
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -53,6 +53,7 @@ import {
|
||||||
AppointmentTypeStrings,
|
AppointmentTypeStrings,
|
||||||
PREMIUM_TIME_SLOT_ID_FLAG,
|
PREMIUM_TIME_SLOT_ID_FLAG,
|
||||||
PREMIUM_FEE_PART_TYPE,
|
PREMIUM_FEE_PART_TYPE,
|
||||||
|
RouteCodeFlags,
|
||||||
} from "@/constants/schedule-constants";
|
} from "@/constants/schedule-constants";
|
||||||
|
|
||||||
// Validation for the modal button
|
// Validation for the modal button
|
||||||
|
|
@ -69,6 +70,7 @@ export default {
|
||||||
mobilePremiumCmsWidgetName: String,
|
mobilePremiumCmsWidgetName: String,
|
||||||
dropoffCmsWidgetName: String,
|
dropoffCmsWidgetName: String,
|
||||||
sameDayDropOffCmsWidgetName: String,
|
sameDayDropOffCmsWidgetName: String,
|
||||||
|
overnightDropOffCmsWidgetName: String,
|
||||||
appointmentType: String,
|
appointmentType: String,
|
||||||
dateAndTimeSlotData: Object,
|
dateAndTimeSlotData: Object,
|
||||||
premiumAppointmentFee: Object,
|
premiumAppointmentFee: Object,
|
||||||
|
|
@ -116,9 +118,15 @@ export default {
|
||||||
? this.mobilePremiumCmsWidgetName
|
? this.mobilePremiumCmsWidgetName
|
||||||
: this.mobileCmsWidgetName;
|
: this.mobileCmsWidgetName;
|
||||||
} else {
|
} else {
|
||||||
appointmentTypeCmsWidgetName = this.isSameDay
|
if (!this.selectedTimeSlotId) {
|
||||||
? this.sameDayDropOffCmsWidgetName
|
return null;
|
||||||
: this.dropoffCmsWidgetName;
|
} else {
|
||||||
|
appointmentTypeCmsWidgetName =
|
||||||
|
this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||||
|
this.selectedTimeSlotId,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this.getCmsContent(appointmentTypeCmsWidgetName, "BodyText");
|
return this.getCmsContent(appointmentTypeCmsWidgetName, "BodyText");
|
||||||
},
|
},
|
||||||
|
|
@ -131,12 +139,36 @@ export default {
|
||||||
dropoffButtonText() {
|
dropoffButtonText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "HeaderText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "HeaderText");
|
||||||
},
|
},
|
||||||
|
overnightDropoffButtonText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "HeaderText");
|
||||||
|
},
|
||||||
dropoffDisclaimerText() {
|
dropoffDisclaimerText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
overnightDropOffDisclaimerText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "FooterText");
|
||||||
|
},
|
||||||
|
disclaimerTextBlockCopy() {
|
||||||
|
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
||||||
|
if (this.isSameDay) {
|
||||||
|
return null;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
|
return this.dropoffDisclaimerText;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
|
return this.overnightDropOffDisclaimerText;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
dropOffDurationText() {
|
dropOffDurationText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "SubheaderText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "SubheaderText");
|
||||||
},
|
},
|
||||||
|
overnightDropoffDurationText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "SubheaderText");
|
||||||
|
},
|
||||||
inshopDurationText() {
|
inshopDurationText() {
|
||||||
const inshopDurationTextWithoutTime = this.getCmsContent(
|
const inshopDurationTextWithoutTime = this.getCmsContent(
|
||||||
this.cmsWidgetName,
|
this.cmsWidgetName,
|
||||||
|
|
@ -154,15 +186,27 @@ export default {
|
||||||
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
||||||
return this.inshopDurationText;
|
return this.inshopDurationText;
|
||||||
} else {
|
} else {
|
||||||
return this.dropOffDurationText;
|
if (this.selectedTimeSlotId?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
|
return this.overnightDropoffDurationText;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
|
return this.dropOffDurationText;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
shouldShowDropoffDisclaimerText() {
|
shouldShowDropoffDisclaimerText() {
|
||||||
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
||||||
},
|
},
|
||||||
isSameDay() {
|
isSameDay() {
|
||||||
return false;
|
if (!this.dateAndTimeSlotData) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const selectedDate = this.dateAndTimeSlotData.date;
|
||||||
|
const todaysDate = new Date().toISOString().split("T")[0];
|
||||||
|
return selectedDate === todaysDate;
|
||||||
},
|
},
|
||||||
|
|
||||||
dateSelectedReadableDate() {
|
dateSelectedReadableDate() {
|
||||||
if (!this.dateAndTimeSlotData) {
|
if (!this.dateAndTimeSlotData) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -233,6 +277,18 @@ export default {
|
||||||
}
|
}
|
||||||
return displayTextForDurationLength;
|
return displayTextForDurationLength;
|
||||||
},
|
},
|
||||||
|
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||||
|
selectedTimeSlotId,
|
||||||
|
isSameDayRelevant = false
|
||||||
|
) {
|
||||||
|
if (selectedTimeSlotId.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
|
return this.overnightDropOffCmsWidgetName;
|
||||||
|
} else if (selectedTimeSlotId.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
|
return this.isSameDay && isSameDayRelevant
|
||||||
|
? this.sameDayDropOffCmsWidgetName
|
||||||
|
: this.dropoffCmsWidgetName;
|
||||||
|
}
|
||||||
|
},
|
||||||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||||
return timeSlotsForSelectedDate.map((timeSlot) => {
|
return timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
const readableTime = this.getDisplayTextForMilitaryTime(timeSlot.startTime);
|
const readableTime = this.getDisplayTextForMilitaryTime(timeSlot.startTime);
|
||||||
|
|
@ -243,12 +299,16 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAvailableTimeSlotsForDropOff(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForDropOff(timeSlotsForSelectedDate) {
|
||||||
return [
|
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
{
|
const buttonLabelValue = timeSlot.id.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)
|
||||||
value: timeSlotsForSelectedDate[0].id,
|
? this.overnightDropoffButtonText
|
||||||
buttonLabel: this.dropoffButtonText,
|
: this.dropoffButtonText;
|
||||||
},
|
return {
|
||||||
];
|
value: timeSlot.id,
|
||||||
|
buttonLabel: buttonLabelValue,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return availableTimeSlots;
|
||||||
},
|
},
|
||||||
getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) {
|
||||||
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
|
|
@ -316,7 +376,7 @@ export default {
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
.text-block.duration-text-block {
|
.text-block.duration-text-block {
|
||||||
margin-top: 0 !important;
|
margin-top: 4px !important;
|
||||||
}
|
}
|
||||||
.supplemental-information {
|
.supplemental-information {
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
|
|
@ -325,7 +385,7 @@ export default {
|
||||||
font-weight: $font-weight-bold;
|
font-weight: $font-weight-bold;
|
||||||
}
|
}
|
||||||
li:not(:last-child) {
|
li:not(:last-child) {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ import { applicationConfig } from "../constants/application-config";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
getPageName() {
|
||||||
|
return getPageNameByQueryString();
|
||||||
|
},
|
||||||
|
|
||||||
logPageView(pageEvent) {
|
logPageView(pageEvent) {
|
||||||
const currentPageName = getPageNameByQueryString();
|
const currentPageName = getPageNameByQueryString();
|
||||||
var payload = {
|
var payload = {
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,12 @@ router.overrideNavigation = (
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
router.getNextPage = () => nextPageName;
|
||||||
|
|
||||||
|
// PRIVATE VARIABLES
|
||||||
|
|
||||||
|
var nextPageName;
|
||||||
|
|
||||||
// PRIVATE FUNCTIONS
|
// PRIVATE FUNCTIONS
|
||||||
|
|
||||||
// Navigate to the next route, depending on the scenario.
|
// Navigate to the next route, depending on the scenario.
|
||||||
|
|
@ -245,6 +251,8 @@ async function navigate(
|
||||||
if (destinationFmgPageValue !== undefined) {
|
if (destinationFmgPageValue !== undefined) {
|
||||||
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
|
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
|
||||||
|
|
||||||
|
nextPageName = destinationFmgPageValue;
|
||||||
|
|
||||||
// Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object
|
// Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object
|
||||||
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);
|
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);
|
||||||
baseMixin.methods.savePageDataToStore(
|
baseMixin.methods.savePageDataToStore(
|
||||||
|
|
|
||||||
|
|
@ -348,14 +348,14 @@ export const mutations = {
|
||||||
state.order.schedule.routeCode = null;
|
state.order.schedule.routeCode = null;
|
||||||
state.order.schedule.jobMaxMinutes = null;
|
state.order.schedule.jobMaxMinutes = null;
|
||||||
|
|
||||||
//early bird fee used on schedule page also needs reset when schedule is reset
|
//premium appointment fee used on schedule page also needs reset when schedule is reset
|
||||||
const supportingItems = state.order.lineItems.supportingItems;
|
const supportingItems = state.order.lineItems.supportingItems;
|
||||||
const removeEarlyBirdIndex = supportingItems.findIndex(
|
const premiumAppointmentFeeIndex = supportingItems?.findIndex(
|
||||||
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
||||||
);
|
);
|
||||||
|
|
||||||
if (removeEarlyBirdIndex >= 0) {
|
if (premiumAppointmentFeeIndex >= 0) {
|
||||||
supportingItems.splice(removeEarlyBirdIndex, 1);
|
supportingItems.splice(premiumAppointmentFeeIndex, 1);
|
||||||
state.order.lineItems.supportingItems = supportingItems;
|
state.order.lineItems.supportingItems = supportingItems;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -384,7 +384,6 @@ export const mutations = {
|
||||||
state.order.serviceLocation.address2 = null;
|
state.order.serviceLocation.address2 = null;
|
||||||
state.order.serviceLocation.city = null;
|
state.order.serviceLocation.city = null;
|
||||||
state.order.serviceLocation.state = null;
|
state.order.serviceLocation.state = null;
|
||||||
state.order.serviceLocation.zipCode = null;
|
|
||||||
state.order.serviceLocation.isVehicleProtected = null;
|
state.order.serviceLocation.isVehicleProtected = null;
|
||||||
},
|
},
|
||||||
// Misc Mutations
|
// Misc Mutations
|
||||||
|
|
@ -727,20 +726,30 @@ export const actions = {
|
||||||
// Dependency Actions
|
// Dependency Actions
|
||||||
resetDamageAndDependencies(context) {
|
resetDamageAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_VAPS, null);
|
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetRegistrationAndDependencies(context) {
|
resetRegistrationAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPartsAndDependencies(context) {
|
resetPartsAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
|
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
},
|
||||||
|
|
||||||
|
resetServiceLocationAndDependencies(context) {
|
||||||
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||||
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||||
|
|
||||||
|
context.commit(storeMutations.RESET_SCHEDULE);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetState(context) {
|
resetState(context) {
|
||||||
|
|
@ -1397,6 +1406,8 @@ export const actions = {
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
additionalSuccessEventDataHandler: (response) =>
|
||||||
|
"Email provided: " + (order.customer.emailAddress ? "true" : "false"),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1612,7 +1623,6 @@ export const actions = {
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1638,7 +1648,6 @@ export const actions = {
|
||||||
|
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1664,6 +1673,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1711,6 +1722,8 @@ export const actions = {
|
||||||
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
previouslySelectedPartNumbers !== currentlySelectedPartNumbers;
|
||||||
|
|
||||||
if (haveSelectedVehiclePartsChanged) {
|
if (haveSelectedVehiclePartsChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1742,6 +1755,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
|
|
@ -1771,6 +1786,8 @@ export const actions = {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (haveCapabilityQuestionAnswersChanged) {
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
}
|
}
|
||||||
|
|
@ -1792,8 +1809,7 @@ export const actions = {
|
||||||
|
|
||||||
saveSupportingItems(context, supportingItems) {
|
saveSupportingItems(context, supportingItems) {
|
||||||
if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {
|
if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
||||||
|
|
@ -1869,8 +1885,8 @@ export const actions = {
|
||||||
context.state.order.serviceLocation &&
|
context.state.order.serviceLocation &&
|
||||||
serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
||||||
) {
|
) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1878,6 +1894,20 @@ export const actions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
saveServiceLocation(context, serviceLocationInfo) {
|
saveServiceLocation(context, serviceLocationInfo) {
|
||||||
|
if (context.state.order.serviceLocation) {
|
||||||
|
if (
|
||||||
|
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode ||
|
||||||
|
!deepEqual(
|
||||||
|
serviceLocationInfo.provider,
|
||||||
|
context.state.order.serviceLocation.provider
|
||||||
|
) ||
|
||||||
|
serviceLocationInfo.appointmentType !==
|
||||||
|
context.state.order.serviceLocation.appointmentType
|
||||||
|
) {
|
||||||
|
context.commit(storeMutations.RESET_SCHEDULE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo);
|
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1890,7 +1920,6 @@ export const actions = {
|
||||||
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
|
||||||
if (!isSelectedGlassAvailableForVehicle) {
|
if (!isSelectedGlassAvailableForVehicle) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1900,8 +1929,7 @@ export const actions = {
|
||||||
|
|
||||||
saveGlassParts(context, parts) {
|
saveGlassParts(context, parts) {
|
||||||
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
||||||
|
|
|
||||||
|
|
@ -547,41 +547,48 @@ describe("Actions", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await actions.resetDamageAndDependencies(context);
|
await actions.resetDamageAndDependencies(context);
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
expect(commit).toBeCalledWith(storeMutations.RESET_DAMAGE_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetRegistrationAndDependencies action", async () => {
|
it("resetRegistrationAndDependencies action", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await actions.resetRegistrationAndDependencies(context);
|
await actions.resetRegistrationAndDependencies(context);
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
expect(commit).toBeCalledWith(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
expect(dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetPartsAndDependencies action", async () => {
|
it("resetPartsAndDependencies action", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await actions.resetPartsAndDependencies(context);
|
await actions.resetPartsAndDependencies(context);
|
||||||
|
|
||||||
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
expect(commit).toBeCalledWith(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
|
expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resetState action", async () => {
|
it("resetState action", async () => {
|
||||||
|
|
@ -933,6 +940,90 @@ describe("Actions", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("saveServiceZipCodeInfo, should call mutation and save zip code to state", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = state;
|
||||||
|
const commit = jest.fn();
|
||||||
|
context.commit = commit;
|
||||||
|
|
||||||
|
const serviceZipCodeInfo = {
|
||||||
|
zipCode: "43212",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceLocation(context, serviceZipCodeInfo);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).toBeCalledWith(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo);
|
||||||
|
expect(state.order.serviceLocation.zipCode).toEqual("43212");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveServiceZipCodeInfo, should reset if zip code is different", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
zipCode: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceZipCodeInfo = {
|
||||||
|
zipCode: "43202",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(dispatch).toHaveBeenCalledWith(
|
||||||
|
storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES
|
||||||
|
);
|
||||||
|
expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveServiceZipCodeInfo, should not reset if zip code is the same", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
zipCode: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceZipCodeInfo = {
|
||||||
|
zipCode: "43212",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceZipCodeInfo(context, serviceZipCodeInfo);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(dispatch).not.toHaveBeenCalledWith(
|
||||||
|
storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES
|
||||||
|
);
|
||||||
|
expect(commit).not.toHaveBeenCalledWith(
|
||||||
|
storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("saveServiceLocation, should call mutation and save service address to state", () => {
|
it("saveServiceLocation, should call mutation and save service address to state", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
|
|
@ -959,6 +1050,242 @@ describe("Actions", () => {
|
||||||
expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820");
|
expect(state.order.serviceLocation.zipCodeCtu).toEqual("01820");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("saveServiceLocation, should reset if zipcode is different", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43202",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveServiceLocation, should reset if provider is different", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "22222",
|
||||||
|
address: {
|
||||||
|
streetAddress: "321 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveServiceLocation, should reset if appointment type is different", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Inshop",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveServiceLocation, should not reset if parameters are the same", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
serviceLocation: {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
const serviceLocation = {
|
||||||
|
address: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
zipCode: "43212",
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
appointmentType: "Mobile",
|
||||||
|
isVehicleProtected: true,
|
||||||
|
provider: {
|
||||||
|
providerNumber: "11111",
|
||||||
|
address: {
|
||||||
|
streetAddress: "123 Test Lane",
|
||||||
|
city: "Columbus",
|
||||||
|
state: "OH",
|
||||||
|
zip: "43212",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveServiceLocation(context, serviceLocation);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).not.toHaveBeenCalledWith(storeMutations.RESET_SCHEDULE);
|
||||||
|
});
|
||||||
|
|
||||||
it("saveGlassParts, should call mutation", () => {
|
it("saveGlassParts, should call mutation", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = {
|
const context = {
|
||||||
|
|
@ -966,14 +1293,88 @@ describe("Actions", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
context.commit = commit;
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
actions.saveGlassParts(context, { glassParts: {} });
|
actions.saveGlassParts(context, { glassParts: {} });
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, { glassParts: {} });
|
expect(commit).toBeCalledWith(storeMutations.UPDATE_GLASS_PARTS, { glassParts: {} });
|
||||||
|
expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveSupportingItems, should call mutations", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: state,
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveSupportingItems(context, []);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(commit).toBeCalledWith(storeMutations.UPDATE_SUPPORTING_ITEMS, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveSupportingItems, should call reset logic when value is new", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: ["TestValue1", "TestValue2"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveSupportingItems(context, ["TestValue3", "TestValue4", "TestValue5"]);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(dispatch).toBeCalledWith(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("saveSupportingItems, should not call reset logic when value is the same", () => {
|
||||||
|
// Arrange
|
||||||
|
const context = {
|
||||||
|
state: {
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
supportingItems: ["TestValue1", "TestValue2"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const commit = jest.fn();
|
||||||
|
const dispatch = jest.fn();
|
||||||
|
|
||||||
|
context.commit = commit;
|
||||||
|
context.dispatch = dispatch;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
actions.saveSupportingItems(context, ["TestValue1", "TestValue2"]);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(dispatch).not.toBeCalledWith(
|
||||||
|
storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("clearVin, should call mutation", () => {
|
it("clearVin, should call mutation", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue