Merge branch 'develop' into feature/CSR-1073
This commit is contained in:
commit
09a0328afa
12 changed files with 173 additions and 44 deletions
|
|
@ -34,6 +34,7 @@ import buttonMain from "@/ux-components/button-main/button-main";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "funnelFooter",
|
name: "funnelFooter",
|
||||||
|
emits: ["BackClicked", "ForwardClicked"], // <--- should remove oodles of warnings in dev tools
|
||||||
props: {
|
props: {
|
||||||
isForwardActionDisabled: Boolean,
|
isForwardActionDisabled: Boolean,
|
||||||
isBackButtonHidden: { type: Boolean, default: false },
|
isBackButtonHidden: { type: Boolean, default: false },
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
<textLink
|
<textLink
|
||||||
linkType="navigation"
|
linkType="navigation"
|
||||||
text="Notice at collection"
|
text="Notice at collection"
|
||||||
href="https://privacyportal-cdn.onetrust.com/dsarwebform/d3b95a93-e22e-4d4d-a806-482052406557/9e371601-eae3-4338-9430-b90b9036022b.html"
|
href="https://www.safelite.com/ccpa-privacy-policy"
|
||||||
target="_blank" />
|
target="_blank" />
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer d-flex justify-content-start">
|
<div class="modal-footer d-flex justify-content-start">
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@
|
||||||
v-model="addressModel.state"
|
v-model="addressModel.state"
|
||||||
ref="state"
|
ref="state"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
initialValue="FL"
|
|
||||||
validationRules="state-required" />
|
validationRules="state-required" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -406,6 +405,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
modelValue: {
|
||||||
|
handler() {
|
||||||
|
this.setupAddressLookup();
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
textboxQuestion,
|
textboxQuestion,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,8 @@
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
export async function getPricedMobileFeePart(
|
export async function getPricedMobileFeePart(serviceZipCode) {
|
||||||
serviceZipCode,
|
if (!serviceZipCode) {
|
||||||
serviceType,
|
|
||||||
parentAccountNumber,
|
|
||||||
billToAccountNumber
|
|
||||||
) {
|
|
||||||
if (!serviceZipCode || !serviceType || !parentAccountNumber) {
|
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16,11 +11,7 @@ export async function getPricedMobileFeePart(
|
||||||
// Get the Mobile Fee Part
|
// Get the Mobile Fee Part
|
||||||
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
|
const mobileFeePart = await baseMixin.methods.dispatchStoreAction(
|
||||||
storeActions.GET_MOBILE_FEE_PART,
|
storeActions.GET_MOBILE_FEE_PART,
|
||||||
{
|
null,
|
||||||
serviceType: serviceType,
|
|
||||||
parentAccountNumber: parentAccountNumber,
|
|
||||||
billToAccountNumber: billToAccountNumber,
|
|
||||||
},
|
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,32 @@ const mockMixin = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mockGetPricedMobileFeePart = (mockServiceZipCode) => {
|
||||||
|
let mobileFeePart = {};
|
||||||
|
|
||||||
|
if (mockServiceZipCode === "43235") {
|
||||||
|
mobileFeePart = {
|
||||||
|
partNumber: "MOBILE FEE",
|
||||||
|
description: "MOBILE FEE",
|
||||||
|
partType: "FEE",
|
||||||
|
laborAmount: 49.99,
|
||||||
|
sellingPrice: 0,
|
||||||
|
kitPrice: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve(mobileFeePart);
|
||||||
|
};
|
||||||
|
|
||||||
|
jest.mock(
|
||||||
|
"@/layouts/service-location/helpers/service-location-helper/service-location-helper",
|
||||||
|
() => ({
|
||||||
|
getPricedMobileFeePart: jest.fn((mockServiceZipCode) => {
|
||||||
|
return mockGetPricedMobileFeePart(mockServiceZipCode);
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
describe("mobile-location-modal-questions.vue", () => {
|
describe("mobile-location-modal-questions.vue", () => {
|
||||||
it("Should copy the modelValue to the internalModel when the component is mounted", async () => {
|
it("Should copy the modelValue to the internalModel when the component is mounted", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,15 @@ import modal from "@/digital-components/modal/modal";
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
|
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
|
||||||
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
|
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
|
import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper";
|
||||||
|
import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "mobile-location-modal-questions",
|
name: "mobile-location-modal-questions",
|
||||||
emits: ["update:modelValue", "updated-zip-code"], // The component emits an event
|
emits: ["update:modelValue", "set-mobile-fee-part"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalModel: deepClone(this.modelValue),
|
internalModel: deepClone(this.modelValue),
|
||||||
|
|
@ -158,15 +160,13 @@ export default {
|
||||||
values: {
|
values: {
|
||||||
state: updatedServiceZipCodeInfo.state,
|
state: updatedServiceZipCodeInfo.state,
|
||||||
zipCode: updatedServiceZipCodeInfo.zipCode,
|
zipCode: updatedServiceZipCodeInfo.zipCode,
|
||||||
|
isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetModalButtonStyle() {
|
resetModalButtonStyle() {
|
||||||
this.$refs[this.modalName].resetButtonStyle();
|
this.$refs[this.modalName].resetButtonStyle();
|
||||||
},
|
},
|
||||||
onAddressUpdated(updatedServiceZipCodeInfo) {
|
|
||||||
this.resetComponent(updatedServiceZipCodeInfo);
|
|
||||||
},
|
|
||||||
async setMobileLocation() {
|
async setMobileLocation() {
|
||||||
// Validate the Zip Code
|
// Validate the Zip Code
|
||||||
const zipCodeData = await this.getZipCodeData(
|
const zipCodeData = await this.getZipCodeData(
|
||||||
|
|
@ -177,6 +177,14 @@ export default {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
this.resetModalButtonStyle();
|
this.resetModalButtonStyle();
|
||||||
} else {
|
} else {
|
||||||
|
// retrieve mobile fee part
|
||||||
|
const serviceZipCode = this.internalModel.addressQuestions.zipCode;
|
||||||
|
|
||||||
|
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
||||||
|
|
||||||
|
// emit it to parent
|
||||||
|
this.$emit("set-mobile-fee-part", mobileFeePart);
|
||||||
|
|
||||||
// Update the page level model
|
// Update the page level model
|
||||||
this.$emit("update:modelValue", this.internalModel);
|
this.$emit("update:modelValue", this.internalModel);
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
|
@ -189,8 +197,9 @@ export default {
|
||||||
this.internalModel = deepClone(newValue);
|
this.internalModel = deepClone(newValue);
|
||||||
|
|
||||||
this.resetComponent({
|
this.resetComponent({
|
||||||
state: newValue.state,
|
state: newValue.addressQuestions.state,
|
||||||
zipCode: newValue.zipCode,
|
zipCode: newValue.addressQuestions.zipCode,
|
||||||
|
isVehicleProtected: newValue.isVehicleProtected,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,22 @@ jest.mock(
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
jest.spyOn(baseMixin.methods, "getZipCodeData").mockImplementation((serviceZipCode) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
let mockContainsMilitaryBase = false;
|
||||||
|
if (serviceZipCode === 45433 || serviceZipCode === "45433") {
|
||||||
|
mockContainsMilitaryBase = true;
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
containsMilitaryBase: mockContainsMilitaryBase,
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: true,
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "01820",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
jest.mock("@/store", () => ({
|
jest.mock("@/store", () => ({
|
||||||
commit: jest.fn(),
|
commit: jest.fn(),
|
||||||
dispatch: jest.fn(),
|
dispatch: jest.fn(),
|
||||||
|
|
@ -291,6 +307,24 @@ describe("service-location.vue", () => {
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions);
|
expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("displays military zip message when zip is updated", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn();
|
||||||
|
expect(wrapper.vm.zipContainsMilitaryBase).toBe(false);
|
||||||
|
|
||||||
|
const newServiceZipCodeQuestion = {
|
||||||
|
zipCode: "45433",
|
||||||
|
state: "OH",
|
||||||
|
};
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
wrapper.setData({ zipCode: newServiceZipCodeQuestion.zipCode });
|
||||||
|
wrapper.vm.$nextTick(() => {
|
||||||
|
expect(wrapper.vm.zipContainsMilitaryBase).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("updating mobile location", () => {
|
describe("updating mobile location", () => {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
<serviceZipModalQuestion
|
<serviceZipModalQuestion
|
||||||
v-model="serviceZipCodeQuestion"
|
v-model="serviceZipCodeQuestion"
|
||||||
ref="serviceZipCodeQuestion"
|
ref="serviceZipCodeQuestion"
|
||||||
|
:mobileFeePart="mobileFeePart"
|
||||||
|
@set-mobile-fee-part="setMobileFeePart"
|
||||||
linkWidgetName="ServiceZipLinkWidget"
|
linkWidgetName="ServiceZipLinkWidget"
|
||||||
modalWidgetName="ServiceZipModalWidget" />
|
modalWidgetName="ServiceZipModalWidget" />
|
||||||
<serviceTypeQuestion
|
<serviceTypeQuestion
|
||||||
|
|
@ -16,17 +18,23 @@
|
||||||
groupName="ServiceTypeQuestion"
|
groupName="ServiceTypeQuestion"
|
||||||
cmsWidgetName="ServiceTypeQuestionWidget"
|
cmsWidgetName="ServiceTypeQuestionWidget"
|
||||||
validationRules="option-required" />
|
validationRules="option-required" />
|
||||||
|
<alert
|
||||||
|
class="my-4"
|
||||||
|
cmsWidgetName="AlertMilitaryBaseZipWidget"
|
||||||
|
v-if="zipContainsMilitaryBase"
|
||||||
|
alertClass="alert-warning" />
|
||||||
<mobileLocationModalQuestions
|
<mobileLocationModalQuestions
|
||||||
v-if="selectedServiceType === 'Mobile'"
|
v-if="selectedServiceType === 'Mobile'"
|
||||||
v-model="mobileLocationQuestions"
|
v-model="mobileLocationQuestions"
|
||||||
:mobileFeePart="mobileFeePart"
|
:mobileFeePart="mobileFeePart"
|
||||||
|
@set-mobile-fee-part="setMobileFeePart"
|
||||||
ref="mobileLocationModalQuestions"
|
ref="mobileLocationModalQuestions"
|
||||||
linkWidgetName="MobileLocationLinkWidget"
|
linkWidgetName="MobileLocationLinkWidget"
|
||||||
modalWidgetName="MobileLocationModalWidget" />
|
modalWidgetName="MobileLocationModalWidget" />
|
||||||
<funnel-footer
|
<funnel-footer
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid || shouldDisableForwardAction"
|
||||||
@back-clicked="backButtonAction"
|
@back-clicked="backButtonAction"
|
||||||
@ForwardClicked="forwardButtonAction" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -36,6 +44,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Components
|
// Components
|
||||||
|
import alert from "@/ux-components/alert/alert";
|
||||||
import serviceZipModalQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-modal-question";
|
import serviceZipModalQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-modal-question";
|
||||||
import mobileLocationModalQuestions from "@/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions";
|
import mobileLocationModalQuestions from "@/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions";
|
||||||
import serviceTypeQuestion from "@/layouts/service-location/service-type-question/service-type-question";
|
import serviceTypeQuestion from "@/layouts/service-location/service-type-question/service-type-question";
|
||||||
|
|
@ -45,6 +54,9 @@ import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-heade
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import { Form } from "vee-validate";
|
import { Form } from "vee-validate";
|
||||||
|
|
||||||
|
// Supporting files
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
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";
|
||||||
|
|
@ -64,17 +76,17 @@ export default {
|
||||||
isZipServiceableMobile: null,
|
isZipServiceableMobile: null,
|
||||||
isZipServiceableInShop: null,
|
isZipServiceableInShop: null,
|
||||||
mobileFeePart: null,
|
mobileFeePart: null,
|
||||||
|
zipContainsMilitaryBase: false,
|
||||||
selectedServiceType: null,
|
selectedServiceType: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
||||||
const serviceZipCode = store.getters.order.serviceLocation.zipCode;
|
const serviceZipCode = store.getters.order.serviceLocation.zipCode;
|
||||||
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
|
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
|
||||||
const parentAccountNumber = store.getters.payment.parentAccountNumber;
|
const parentAccountNumber = store.getters.payment.parentAccountNumber;
|
||||||
const billToAccountNumber = 0;
|
const billToAccountNumber = 1;
|
||||||
|
|
||||||
const mobileFeePartPromise = getPricedMobileFeePart(
|
const mobileFeePartPromise = getPricedMobileFeePart(
|
||||||
serviceZipCode,
|
serviceZipCode,
|
||||||
|
|
@ -93,6 +105,10 @@ export default {
|
||||||
resultKey: "mobileFeePart",
|
resultKey: "mobileFeePart",
|
||||||
promise: mobileFeePartPromise,
|
promise: mobileFeePartPromise,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resultKey: "zipCodeData",
|
||||||
|
promise: baseMixin.methods.getZipCodeData(serviceZipCode),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
@ -101,6 +117,8 @@ export default {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.setData(resultMap.mobileFeePart);
|
vm.setData(resultMap.mobileFeePart);
|
||||||
|
vm.zipContainsMilitaryBase = resultMap.zipCodeData.containsMilitaryBase;
|
||||||
|
vm.zipCode = serviceZipCode;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -113,7 +131,7 @@ export default {
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
if (newValue.zipCode !== this.zipCode) {
|
if (newValue.zipCode !== this.zipCode) {
|
||||||
this.resetMobileLocation(newValue);
|
this.resetMobileLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = newValue.state;
|
this.state = newValue.state;
|
||||||
|
|
@ -143,6 +161,9 @@ export default {
|
||||||
this.isVehicleProtected = newValue.isVehicleProtected;
|
this.isVehicleProtected = newValue.isVehicleProtected;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
shouldDisableForwardAction() {
|
||||||
|
return this.zipContainsMilitaryBase;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
@ -170,28 +191,15 @@ export default {
|
||||||
getServiceZipCodeFromStore() {
|
getServiceZipCodeFromStore() {
|
||||||
return store.getters.order.serviceLocation.zipCode;
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
},
|
},
|
||||||
resetMobileFeePart(serviceZipCode) {
|
setMobileFeePart(mobileFeePart) {
|
||||||
const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace";
|
this.mobileFeePart = mobileFeePart;
|
||||||
const parentAccountNumber = store.getters.payment.parentAccountNumber;
|
|
||||||
const billToAccountNumber = 0;
|
|
||||||
|
|
||||||
getPricedMobileFeePart(
|
|
||||||
serviceZipCode,
|
|
||||||
serviceType,
|
|
||||||
parentAccountNumber,
|
|
||||||
billToAccountNumber
|
|
||||||
).then((pricedMobileFeePart) => {
|
|
||||||
this.mobileFeePart = pricedMobileFeePart;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
resetMobileLocation(updatedServiceZipCodeInfo) {
|
resetMobileLocation() {
|
||||||
this.streetAddress = "";
|
this.streetAddress = "";
|
||||||
this.apartmentNumberOrBusinessName = "";
|
this.apartmentNumberOrBusinessName = "";
|
||||||
this.city = "";
|
this.city = "";
|
||||||
|
|
||||||
this.isVehicleProtected = null;
|
this.isVehicleProtected = null;
|
||||||
|
|
||||||
this.resetMobileFeePart(updatedServiceZipCodeInfo.zipCode);
|
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
|
|
@ -200,7 +208,17 @@ export default {
|
||||||
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
zipCode(current, previous) {
|
||||||
|
if (current !== previous) {
|
||||||
|
baseMixin.methods.getZipCodeData(current).then((r) => {
|
||||||
|
this.zipContainsMilitaryBase = r.containsMilitaryBase;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
|
alert,
|
||||||
serviceZipModalQuestion,
|
serviceZipModalQuestion,
|
||||||
serviceTypeQuestion,
|
serviceTypeQuestion,
|
||||||
mobileLocationModalQuestions,
|
mobileLocationModalQuestions,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,32 @@ jest.mock("@/digital-components/modal/modal", () => ({
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const mockGetPricedMobileFeePart = (mockServiceZipCode) => {
|
||||||
|
let mobileFeePart = {};
|
||||||
|
|
||||||
|
if (mockServiceZipCode === "43235") {
|
||||||
|
mobileFeePart = {
|
||||||
|
partNumber: "MOBILE FEE",
|
||||||
|
description: "MOBILE FEE",
|
||||||
|
partType: "FEE",
|
||||||
|
laborAmount: 49.99,
|
||||||
|
sellingPrice: 0,
|
||||||
|
kitPrice: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve(mobileFeePart);
|
||||||
|
};
|
||||||
|
|
||||||
|
jest.mock(
|
||||||
|
"@/layouts/service-location/helpers/service-location-helper/service-location-helper",
|
||||||
|
() => ({
|
||||||
|
getPricedMobileFeePart: jest.fn((mockServiceZipCode) => {
|
||||||
|
return mockGetPricedMobileFeePart(mockServiceZipCode);
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const linkWidgetName = "linkWidgetName";
|
const linkWidgetName = "linkWidgetName";
|
||||||
const modalWidgetName = "modalWidgetName";
|
const modalWidgetName = "modalWidgetName";
|
||||||
|
|
||||||
|
|
@ -126,6 +152,7 @@ describe("service-zip-modal-question.vue", () => {
|
||||||
mixins: [mockMixin],
|
mixins: [mockMixin],
|
||||||
props: {
|
props: {
|
||||||
modelValue: serviceZipCodeQuestion,
|
modelValue: serviceZipCodeQuestion,
|
||||||
|
mobileFeePart: {},
|
||||||
linkWidgetName: linkWidgetName,
|
linkWidgetName: linkWidgetName,
|
||||||
modalWidgetName: modalWidgetName,
|
modalWidgetName: modalWidgetName,
|
||||||
},
|
},
|
||||||
|
|
@ -134,6 +161,7 @@ describe("service-zip-modal-question.vue", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.internalModel.zipCode = zip;
|
wrapper.vm.internalModel.zipCode = zip;
|
||||||
|
|
||||||
await wrapper.vm.setZipCode();
|
await wrapper.vm.setZipCode();
|
||||||
|
|
||||||
let expectedEmit = [[{ state: "OH", zipCode: "43235" }]];
|
let expectedEmit = [[{ state: "OH", zipCode: "43235" }]];
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,12 @@ import textLink from "@/ux-components/text-link/text-link";
|
||||||
import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question";
|
import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question";
|
||||||
import modal from "@/digital-components/modal/modal";
|
import modal from "@/digital-components/modal/modal";
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import store from "@/store";
|
||||||
|
import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
|
emits: ["update:modelValue", "set-mobile-fee-part"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
internalModel: this.copyModel(this.modelValue),
|
internalModel: this.copyModel(this.modelValue),
|
||||||
|
|
@ -56,6 +59,10 @@ export default {
|
||||||
zipCode: "",
|
zipCode: "",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
mobileFeePart: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
linkWidgetName: String,
|
linkWidgetName: String,
|
||||||
modalWidgetName: String,
|
modalWidgetName: String,
|
||||||
},
|
},
|
||||||
|
|
@ -136,17 +143,23 @@ export default {
|
||||||
this.resetAlerts();
|
this.resetAlerts();
|
||||||
|
|
||||||
const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode);
|
const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode);
|
||||||
this.resetModalButtonStyle();
|
|
||||||
|
|
||||||
if (!zipCodeData.isValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
this.focusOnZipInput();
|
this.focusOnZipInput();
|
||||||
|
this.resetModalButtonStyle();
|
||||||
} else {
|
} else {
|
||||||
this.internalModel.state = zipCodeData.state;
|
this.internalModel.state = zipCodeData.state;
|
||||||
|
|
||||||
|
// retrieve mobile fee part
|
||||||
|
const serviceZipCode = this.internalModel.zipCode;
|
||||||
|
const mobileFeePart = await getPricedMobileFeePart(serviceZipCode);
|
||||||
|
|
||||||
|
// emit it to parent
|
||||||
|
this.$emit("set-mobile-fee-part", mobileFeePart);
|
||||||
|
|
||||||
// Update the page level model
|
// Update the page level model
|
||||||
this.$emit("update:modelValue", this.internalModel);
|
this.$emit("update:modelValue", this.internalModel);
|
||||||
|
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ export default {
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
containsMilitaryBase: serviceZipValidationResponse.data.containsMilitaryBase,
|
||||||
isValid: serviceZipValidationResponse.data.isValid,
|
isValid: serviceZipValidationResponse.data.isValid,
|
||||||
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||||
state: serviceZipValidationResponse.data.state,
|
state: serviceZipValidationResponse.data.state,
|
||||||
|
|
|
||||||
|
|
@ -916,9 +916,13 @@ export const actions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
getMobileFeePart(context) {
|
getMobileFeePart(context) {
|
||||||
return globalMethods.callMockHttpClient({
|
const serviceType = context.getters.damage.isRepair ? "Repair" : "Replace";
|
||||||
|
const parentAccountNumber = context.getters.payment.parentAccountNumber;
|
||||||
|
const billToAccountNumber = 87291; // TODO: MAKE THIS REAL
|
||||||
|
|
||||||
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetMobileFeePart.method,
|
method: endpoints.GetMobileFeePart.method,
|
||||||
endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce", //TODO: Remove Mocky Endpoint
|
endpoint: `${endpoints.GetMobileFeePart.url}/${serviceType}/${parentAccountNumber}/${billToAccountNumber}`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue