Merge branch 'develop' into CSR-2115-remove-recal-from-cart
This commit is contained in:
commit
4d4b978678
36 changed files with 1685 additions and 398 deletions
|
|
@ -25,6 +25,14 @@ const queryStrings = {
|
||||||
REFERRAL_NUMBER: "rn",
|
REFERRAL_NUMBER: "rn",
|
||||||
PARENT_ACCOUNT: "pa",
|
PARENT_ACCOUNT: "pa",
|
||||||
CORRELATION_ID: "ci",
|
CORRELATION_ID: "ci",
|
||||||
|
VEHICLE_YEAR: "vehicleyear",
|
||||||
|
VEHICLE_MAKE: "vehiclemake",
|
||||||
|
VEHICLE_MODEL: "vehiclemodel",
|
||||||
|
VEHICLE_STYLE: "vehiclestyle",
|
||||||
|
VEHICLE_DAMAGE: "vehicledamage",
|
||||||
|
SERVICE_ZIP: "servicezip",
|
||||||
|
EMAIL: "email",
|
||||||
|
IS_INSURANCE: "isinsurance",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { queryStrings };
|
export { queryStrings };
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ const storeActions = {
|
||||||
|
|
||||||
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
||||||
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
||||||
|
RESET_IS_LEAD_GEN: "resetIsLeadGen",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ const storeMutations = {
|
||||||
Customer_Portal_Login_Token: "updateCustomerPortalLoginToken",
|
Customer_Portal_Login_Token: "updateCustomerPortalLoginToken",
|
||||||
LOCK_TOKEN: "updateLockToken",
|
LOCK_TOKEN: "updateLockToken",
|
||||||
UPDATE_SETTLED_TENDER_AMOUNT: "updateSettledTenderAmount",
|
UPDATE_SETTLED_TENDER_AMOUNT: "updateSettledTenderAmount",
|
||||||
|
UPDATE_IS_LEAD_GEN: "updateIsLeadGen",
|
||||||
|
|
||||||
// EVENT BUS MUTATIONS
|
// EVENT BUS MUTATIONS
|
||||||
ADD_EVENT_TO_BUS: "addEventToBus",
|
ADD_EVENT_TO_BUS: "addEventToBus",
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ const vinLookupMethodSelections = {
|
||||||
MANUALVIN: "ManualVin",
|
MANUALVIN: "ManualVin",
|
||||||
LICENSEPLATE: "LicensePlate",
|
LICENSEPLATE: "LicensePlate",
|
||||||
HOMEADDRESS: "HomeAddress",
|
HOMEADDRESS: "HomeAddress",
|
||||||
|
DECLINE: "Decline",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { vinLookupMethodSelections };
|
export { vinLookupMethodSelections };
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ export default {
|
||||||
classes = "ui-checkbox d-flex";
|
classes = "ui-checkbox d-flex";
|
||||||
break;
|
break;
|
||||||
case "servicePackageRadio":
|
case "servicePackageRadio":
|
||||||
classes = "package-main";
|
classes = "package-main d-md-flex justify-content-center";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
|
|
@ -226,7 +226,7 @@ export default {
|
||||||
if (this.buttonTypeString == "radio") {
|
if (this.buttonTypeString == "radio") {
|
||||||
classes += " radio-button-container";
|
classes += " radio-button-container";
|
||||||
} else if (this.buttonTypeString == "servicePackageRadio") {
|
} else if (this.buttonTypeString == "servicePackageRadio") {
|
||||||
classes = "package-wrapper";
|
classes = "package-wrapper col-md-4";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.buttonTypeString == "listCard" && this.buttonsInfo.length > 2) {
|
if (this.buttonTypeString == "listCard" && this.buttonsInfo.length > 2) {
|
||||||
|
|
|
||||||
|
|
@ -243,11 +243,11 @@ export default {
|
||||||
this.fillInAddress
|
this.fillInAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
// When the Street Address textbox receives focus,
|
// When the Street Address textbox receives input for the first time,
|
||||||
// append the search results list container to the bottom of the textbox
|
// append the search results list container to the bottom of the textbox
|
||||||
// and disable browser autofill
|
// and disable browser autofill
|
||||||
this.addressField1.addEventListener(
|
this.addressField1.addEventListener(
|
||||||
"focus",
|
"keydown",
|
||||||
(e) => {
|
(e) => {
|
||||||
// Make place results box stick to the input on scroll
|
// Make place results box stick to the input on scroll
|
||||||
const streetAddressField = document.getElementById("streetAddressField");
|
const streetAddressField = document.getElementById("streetAddressField");
|
||||||
|
|
@ -276,6 +276,7 @@ export default {
|
||||||
const addressFields = document.querySelectorAll(
|
const addressFields = document.querySelectorAll(
|
||||||
".address-questions input, .address-questions select"
|
".address-questions input, .address-questions select"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (let addressField of addressFields) {
|
for (let addressField of addressFields) {
|
||||||
addressField.addEventListener("input", (e) => {
|
addressField.addEventListener("input", (e) => {
|
||||||
switch (e.inputType) {
|
switch (e.inputType) {
|
||||||
|
|
|
||||||
|
|
@ -263,49 +263,6 @@ describe("cart.vue", () => {
|
||||||
expect(found).toBe(true);
|
expect(found).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mobile Fee Cart Item
|
|
||||||
test("if there is mobile fee on the order, a mobile fee cart item should be added to the cart", () => {
|
|
||||||
// Arrange
|
|
||||||
const lineItems = {
|
|
||||||
glassParts: [],
|
|
||||||
supportingItems: [
|
|
||||||
{
|
|
||||||
description: null,
|
|
||||||
id: "9ff98501-03a4-432b-884e-e4e28f884a2f",
|
|
||||||
kitPrice: 0,
|
|
||||||
laborAmount: 34.98,
|
|
||||||
partNumber: "MOBILE FEE",
|
|
||||||
partType: "MOBILE FEE",
|
|
||||||
salesTax: 2.62,
|
|
||||||
sellingPrice: 0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vaps: [],
|
|
||||||
promos: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
const availableVaps = [];
|
|
||||||
|
|
||||||
// Act
|
|
||||||
const { wrapper } = setupMocks({
|
|
||||||
props: {
|
|
||||||
modelValue: lineItems,
|
|
||||||
availableVaps: availableVaps,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.mobileFeeCartItem).not.toBeNull();
|
|
||||||
expect(wrapper.vm.mobileFeeCartItem.subTotal).toEqual(34.98);
|
|
||||||
expect(wrapper.vm.mobileFeeCartItem.salesTax).toEqual(2.62);
|
|
||||||
|
|
||||||
const found =
|
|
||||||
wrapper.vm.cartItems.findIndex(
|
|
||||||
(cartItem) => cartItem == wrapper.vm.mobileFeeCartItem
|
|
||||||
) >= 0;
|
|
||||||
expect(found).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Service package discount Fee Cart Item
|
// Service package discount Fee Cart Item
|
||||||
test("if there is service package discount fee on the order, a service package discount cart item should be added to the cart", () => {
|
test("if there is service package discount fee on the order, a service package discount cart item should be added to the cart", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
|
||||||
|
|
@ -377,9 +377,6 @@ export default {
|
||||||
cartItems.push(this.suppliesRepairCartItem);
|
cartItems.push(this.suppliesRepairCartItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mobileFeeCartItem) {
|
|
||||||
cartItems.push(this.mobileFeeCartItem);
|
|
||||||
}
|
|
||||||
if (this.servicePackageDiscountCartItem) {
|
if (this.servicePackageDiscountCartItem) {
|
||||||
cartItems.push(this.servicePackageDiscountCartItem);
|
cartItems.push(this.servicePackageDiscountCartItem);
|
||||||
}
|
}
|
||||||
|
|
@ -670,13 +667,27 @@ export default {
|
||||||
recycleFeeCartItemName() {
|
recycleFeeCartItemName() {
|
||||||
return this.getCmsContent("RecycleFeeTextWidget", "Text");
|
return this.getCmsContent("RecycleFeeTextWidget", "Text");
|
||||||
},
|
},
|
||||||
|
requiresRecycleFeeCartItem() {
|
||||||
|
return !this.isRepair;
|
||||||
|
},
|
||||||
recycleFeeCartItem() {
|
recycleFeeCartItem() {
|
||||||
let cartItem = null;
|
let cartItem = null;
|
||||||
|
|
||||||
const recycleFeeLineItem = this.supportingItems.find(
|
let recycleFeeLineItem = this.supportingItems.find(
|
||||||
(supportingItem) => supportingItem.partType == partTypeStrings.REPLACE_FEE
|
(supportingItem) => supportingItem.partType == partTypeStrings.REPLACE_FEE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!recycleFeeLineItem && this.requiresRecycleFeeCartItem) {
|
||||||
|
recycleFeeLineItem = {
|
||||||
|
partNumber: partTypeStrings.RECYCLE_FEE,
|
||||||
|
partType: partTypeStrings.REPLACE_FEE,
|
||||||
|
laborAmount: 0,
|
||||||
|
kitPrice: 0,
|
||||||
|
sellingPrice: 0,
|
||||||
|
salesTax: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (recycleFeeLineItem) {
|
if (recycleFeeLineItem) {
|
||||||
cartItem = {
|
cartItem = {
|
||||||
name: this.recycleFeeCartItemName,
|
name: this.recycleFeeCartItemName,
|
||||||
|
|
@ -745,44 +756,6 @@ export default {
|
||||||
|
|
||||||
return cartItem;
|
return cartItem;
|
||||||
},
|
},
|
||||||
mobileFeeCartItemName() {
|
|
||||||
return this.getCmsContent("MobileServiceTextWidget", "Text");
|
|
||||||
},
|
|
||||||
mobileFeeCartItem() {
|
|
||||||
let cartItem = null;
|
|
||||||
|
|
||||||
const mobileFeeLineItem = this.supportingItems.find(
|
|
||||||
(lineItem) => lineItem.partType == partTypeStrings.MOBILE_FEE
|
|
||||||
);
|
|
||||||
|
|
||||||
if (mobileFeeLineItem) {
|
|
||||||
cartItem = {
|
|
||||||
name: this.mobileFeeCartItemName,
|
|
||||||
category: cartItemCategories.SUPPORTING_ITEMS,
|
|
||||||
cartItemType: cartItemTypes.MOBILE_FEE,
|
|
||||||
isDisplayed: true,
|
|
||||||
isRemovable: false,
|
|
||||||
subTotal: 0,
|
|
||||||
salesTax: 0,
|
|
||||||
lineItems: [],
|
|
||||||
isCoveredByInsurance: cartItemTypesCoveredByInsurance.includes(
|
|
||||||
cartItemTypes.MOBILE_FEE
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
mobileFeeLineItem.cartItemType = cartItem.cartItemType;
|
|
||||||
cartItem.lineItems.push(mobileFeeLineItem);
|
|
||||||
|
|
||||||
cartItem.subTotal +=
|
|
||||||
(mobileFeeLineItem.kitPrice ?? 0) +
|
|
||||||
(mobileFeeLineItem.laborAmount ?? 0) +
|
|
||||||
(mobileFeeLineItem.sellingPrice ?? 0);
|
|
||||||
|
|
||||||
cartItem.salesTax += mobileFeeLineItem.salesTax ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cartItem;
|
|
||||||
},
|
|
||||||
servicePackageDiscountCartItemName() {
|
servicePackageDiscountCartItemName() {
|
||||||
return this.getCmsContent("ServicePackageDiscountTextWidget", "Text");
|
return this.getCmsContent("ServicePackageDiscountTextWidget", "Text");
|
||||||
},
|
},
|
||||||
|
|
@ -986,7 +959,10 @@ export default {
|
||||||
if (!this.showAsPaid) {
|
if (!this.showAsPaid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return this.subTotal + this.salesTax;
|
|
||||||
|
// unary plus operator to convert string amount to numeric so we can add them together
|
||||||
|
var amtPaid = +this.subTotal + +this.salesTax;
|
||||||
|
return amtPaid;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,17 @@
|
||||||
:modalId="ModalName"
|
:modalId="ModalName"
|
||||||
:footerButtonText="ModalCloseButtonText"
|
:footerButtonText="ModalCloseButtonText"
|
||||||
@footer-button-event="footerButtonClick">
|
@footer-button-event="footerButtonClick">
|
||||||
<img :src="ModalImage" class="mw-100 d-flex mx-auto mb-4" alt="" />
|
<div :class="[isRecal ? 'recal-modal' : '']">
|
||||||
<h5 class="mb-4" v-html="ModalHeadline"></h5>
|
<img :src="ModalImage" class="mw-100 d-flex mx-auto mb-4" alt="" />
|
||||||
<p class="fw-bold mb-2 subheader-text" v-html="ModalSubheadertext"></p>
|
<h5 class="mb-4" v-html="ModalHeadline"></h5>
|
||||||
<p class="mb-0" v-html="ModalBodyText"></p>
|
<p class="fw-bold mb-2 subheader-text" v-html="ModalSubheadertext"></p>
|
||||||
<p
|
<p class="mb-0" v-html="ModalBodyText"></p>
|
||||||
class="my-4 caption modal-sub-body"
|
<p
|
||||||
v-if="ModalSubBodyText"
|
class="my-4 caption modal-sub-body"
|
||||||
v-html="ModalSubBodyText"></p>
|
v-if="ModalSubBodyText"
|
||||||
<slot></slot>
|
v-html="ModalSubBodyText"></p>
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -27,6 +29,7 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
isRecal: Boolean,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
ModalName() {
|
ModalName() {
|
||||||
|
|
@ -78,6 +81,21 @@ export default {
|
||||||
.modal-dialog {
|
.modal-dialog {
|
||||||
.modal-content {
|
.modal-content {
|
||||||
.modal-body {
|
.modal-body {
|
||||||
|
.recal-modal {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
h5 {
|
||||||
|
text-align: center;
|
||||||
|
line-height: 32px;
|
||||||
|
order: 1;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
order: 3;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
order: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
.modal-sub-body {
|
.modal-sub-body {
|
||||||
color: $gray-600;
|
color: $gray-600;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,18 @@ describe("estimate.vue", () => {
|
||||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO KO
|
test("Selecting no vin on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
|
||||||
describe("isRepair", () => {
|
//Arrange
|
||||||
test.todo("is repair and zip codes are valid/serviceable => go to quote page");
|
const { wrapper } = setupMocks({});
|
||||||
test.todo(
|
await wrapper.setData({
|
||||||
"is repair and zip codes are valid but not serviceable => show correct alert, remove loader"
|
selectedVinLookupMethod: vinLookupMethodSelections.DECLINE,
|
||||||
);
|
});
|
||||||
test.todo(
|
|
||||||
"is repair and zip codes are not valid/serviceable => show correct alert, remove loader"
|
//Act
|
||||||
);
|
wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -207,43 +210,33 @@ describe("estimate.vue", () => {
|
||||||
expect(arePagePrerequisitesValid).toBe(true);
|
expect(arePagePrerequisitesValid).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Changing zip should reset alert", async () => {
|
|
||||||
//Arrange
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
|
|
||||||
//Act
|
|
||||||
wrapper.vm.displayNonServiceableZipAlert = "true";
|
|
||||||
wrapper.vm.serviceZipCode = "43015";
|
|
||||||
|
|
||||||
await wrapper.vm.$nextTick();
|
|
||||||
|
|
||||||
//Assert
|
|
||||||
expect(wrapper.vm.displayNonServiceableZipAlert).toEqual(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("test alertInfo and isRepair", () => {
|
describe("estimate.vue", () => {
|
||||||
const skipOptions = [
|
test("should call forwardButtonAction if isLeadGen is true", async () => {
|
||||||
[true, false, "AlertQuoteReady"],
|
// update store with isLeadGen as true
|
||||||
[false, true, "AlertQuoteVinOptional"],
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
||||||
[false, false, "AlertQuoteReady"],
|
|
||||||
[true, true, "AlertQuoteVinOptional"],
|
|
||||||
];
|
|
||||||
test.each(skipOptions)(
|
|
||||||
"isRepair %s, skipVinNotRepair %s alertInfo should return %s",
|
|
||||||
async (isRepair, skipVinNotRepair, expectedAlertInfo) => {
|
|
||||||
const { wrapper } = setupMocks({});
|
|
||||||
await wrapper.setData({
|
|
||||||
skipVinNotRepair: skipVinNotRepair,
|
|
||||||
});
|
|
||||||
|
|
||||||
store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair);
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
expect(wrapper.vm.alertInfo).toEqual(expectedAlertInfo);
|
// Set selectedVinLookupMethod to decline
|
||||||
expect(wrapper.vm.isRepair).toEqual(isRepair);
|
wrapper.setData({ selectedVinLookupMethod: vinLookupMethodSelections.DECLINE });
|
||||||
}
|
|
||||||
);
|
// Call the method that contains the if-else logic
|
||||||
|
await estimate.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "estimate" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<div class="col-md-6 col-xl-4">
|
<div class="col-md-6 col-xl-4">
|
||||||
<vehicleBanner cmsWidgetName="VehicleBannerWidget" />
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" />
|
||||||
<funnelSubHeader class="pb-4" cmsWidgetName="FunnelSubHeaderWidget" />
|
<funnelSubHeader class="pb-4" cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
<div v-if="!skipVin">
|
<div>
|
||||||
<div class="vinlookupquestion" v-html="this.VinLookupQuestionText"></div>
|
<div class="vinlookupquestion" v-html="this.VinLookupQuestionText"></div>
|
||||||
<buttonQuestion
|
<buttonQuestion
|
||||||
cmsWidgetName="VinLookupMethod"
|
cmsWidgetName="VinLookupMethod"
|
||||||
|
|
@ -22,65 +22,14 @@
|
||||||
isRequired
|
isRequired
|
||||||
validationRules="option-required"
|
validationRules="option-required"
|
||||||
:logDisplayedValuesEvent="true" />
|
:logDisplayedValuesEvent="true" />
|
||||||
|
|
||||||
<navbar
|
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
|
||||||
ref="navbar"
|
|
||||||
:isForwardActionDisabled="!meta.valid"
|
|
||||||
@back-clicked="backButtonAction"
|
|
||||||
@ForwardClicked="forwardButtonAction" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<navbar
|
||||||
<alert
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
class="mt-4 mb-4"
|
ref="navbar"
|
||||||
:cmsWidgetName="alertInfo"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
alertClass="alert-info"
|
@back-clicked="backButtonAction"
|
||||||
v-bind:isDismissible="false" />
|
@ForwardClicked="forwardButtonAction" />
|
||||||
|
|
||||||
<textboxQuestion
|
|
||||||
class="mb-4"
|
|
||||||
cmsWidgetName="ServiceZipQuestionWidget"
|
|
||||||
v-model="serviceZipCode"
|
|
||||||
inputId="serviceZipCode"
|
|
||||||
mask="#####"
|
|
||||||
isRequired
|
|
||||||
validationRules="zip-required|zip-format" />
|
|
||||||
|
|
||||||
<textboxQuestion
|
|
||||||
class="mb-0"
|
|
||||||
cmsWidgetName="EmailAddressQuestionWidget"
|
|
||||||
v-model="emailAddress"
|
|
||||||
inputId="emailAddress"
|
|
||||||
:isRequired="!IsEmailOptional"
|
|
||||||
disableAutoFill
|
|
||||||
:validationRules="EmailValidationRules"
|
|
||||||
:addOptionalText="IsEmailOptional" />
|
|
||||||
<textBlock cmsWidgetName="QuoteEmailTextBlockWidget" typeStyle="caption" />
|
|
||||||
|
|
||||||
<alert
|
|
||||||
ref="alertInvalidZip"
|
|
||||||
v-if="displayInvalidZipAlert"
|
|
||||||
class="my-4"
|
|
||||||
cmsWidgetName="AlertInvalidZipWidget"
|
|
||||||
alertClass="alert-danger"
|
|
||||||
v-bind:isDismissible="false" />
|
|
||||||
|
|
||||||
<alert
|
|
||||||
class="my-4"
|
|
||||||
:manualHeadline="AlertNonServiceableZipHeader"
|
|
||||||
:manualCopy="AlertNonServiceableZipBody"
|
|
||||||
v-model="customAlertData"
|
|
||||||
v-if="displayNonServiceableZipAlert"
|
|
||||||
alertClass="alert-danger" />
|
|
||||||
|
|
||||||
<navbar
|
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
|
||||||
ref="navbar"
|
|
||||||
:isForwardActionDisabled="!meta.valid"
|
|
||||||
@back-clicked="backButtonAction"
|
|
||||||
@ForwardClicked="forwardButtonAction" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -94,9 +43,6 @@ import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
import vehicleBanner from "@/fmg-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/fmg-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
import buttonQuestion from "@/digital-components/button-question/button-question";
|
import buttonQuestion from "@/digital-components/button-question/button-question";
|
||||||
import alert from "@/ux-components/alert/alert";
|
|
||||||
import textboxQuestion from "@/digital-components/textbox-question/textbox-question";
|
|
||||||
import textBlock from "@/digital-components/text-block/text-block";
|
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
|
|
||||||
//Supporting Files
|
//Supporting Files
|
||||||
|
|
@ -137,10 +83,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedVinLookupMethod: null,
|
selectedVinLookupMethod: null,
|
||||||
serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode,
|
|
||||||
emailAddress: this.getEmailFromStore(),
|
|
||||||
displayInvalidZipAlert: false,
|
|
||||||
displayNonServiceableZipAlert: false,
|
|
||||||
skipVin: false,
|
skipVin: false,
|
||||||
skipVinNotRepair: false,
|
skipVinNotRepair: false,
|
||||||
};
|
};
|
||||||
|
|
@ -185,22 +127,12 @@ export default {
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const skipVin = await skipVinLookup();
|
|
||||||
const skipVinNotRepair = await skipVinLookupNotRepair();
|
|
||||||
|
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.skipVin = skipVin;
|
|
||||||
vm.skipVinNotRepair = skipVinNotRepair;
|
|
||||||
if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) {
|
if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) {
|
||||||
const forwardTextOption =
|
const forwardTextOption =
|
||||||
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|");
|
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|");
|
||||||
if (skipVin) {
|
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText = forwardTextOption[0];
|
||||||
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText =
|
|
||||||
forwardTextOption[1];
|
|
||||||
} else {
|
|
||||||
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText =
|
|
||||||
forwardTextOption[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zip || resultMap.vinByAddress === false) {
|
if (!zip || resultMap.vinByAddress === false) {
|
||||||
|
|
@ -213,15 +145,16 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
vm.selectedVinLookupMethod = vinLookupMethodSelections.DECLINE;
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getZipFromStore() {
|
|
||||||
return store.getters.order.serviceLocation.zipCode;
|
|
||||||
},
|
|
||||||
getEmailFromStore() {
|
|
||||||
return store.getters.order.customer.emailAddress;
|
|
||||||
},
|
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
||||||
},
|
},
|
||||||
|
|
@ -230,80 +163,6 @@ export default {
|
||||||
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
if (this.skipVin) {
|
|
||||||
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
|
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
|
|
||||||
await this.dispatchStoreAction(
|
|
||||||
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
|
||||||
{
|
|
||||||
zipCode: this.serviceZipCode,
|
|
||||||
state: zipCodeData.state,
|
|
||||||
zipCodeCtu: zipCodeData.zipCodeCtu,
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!zipCodeData.isValid) {
|
|
||||||
this.displayInvalidZipAlert = true;
|
|
||||||
return this.$refs.navbar.removeLoader();
|
|
||||||
}
|
|
||||||
this.displayInvalidZipAlert = false;
|
|
||||||
|
|
||||||
if (!zipCodeData.isServiceable) {
|
|
||||||
this.displayNonServiceableZipAlert = true;
|
|
||||||
return this.$refs.navbar.removeLoader();
|
|
||||||
}
|
|
||||||
this.displayNonServiceableZipAlert = false;
|
|
||||||
|
|
||||||
const payment = this.$store.getters.payment;
|
|
||||||
const policy = this.$store.getters.policy;
|
|
||||||
|
|
||||||
const vehicleChangedDuringPolicyLookupInHeritage =
|
|
||||||
payment.isInsurance &&
|
|
||||||
payment.insuranceCoverage.coverageStatus &&
|
|
||||||
policy.policyNumber !== "";
|
|
||||||
|
|
||||||
if (vehicleChangedDuringPolicyLookupInHeritage) {
|
|
||||||
navigateToHeritageFunnel({
|
|
||||||
shouldSaveSession: true,
|
|
||||||
pageNameToLog: "estimate",
|
|
||||||
});
|
|
||||||
} else if (this.$store.getters.order.referralNumber?.length === 6) {
|
|
||||||
await this.navigateForwardWithSingleCarMatch();
|
|
||||||
} else if (this.isRepair) {
|
|
||||||
const supportingItemsPromise = await this.dispatchStoreActionWithLogging(
|
|
||||||
storeActions.GET_SUPPORTING_ITEMS,
|
|
||||||
null,
|
|
||||||
"estimate"
|
|
||||||
);
|
|
||||||
|
|
||||||
const promiseResultMap = [
|
|
||||||
{
|
|
||||||
resultKey: "supportingItems",
|
|
||||||
promise: supportingItemsPromise,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
|
||||||
|
|
||||||
this.dispatchStoreAction(
|
|
||||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
|
||||||
resultMap.supportingItems,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// call saveSession here - navigateWithSaving saves too late in the flow
|
|
||||||
await saveSession({ pageNameToLog: "estimate" });
|
|
||||||
return this.$router.navigateWithSaving(
|
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
|
||||||
this.$route
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// if we're skipping the vin-lookup but it's not a repair, we still need to get the parts
|
|
||||||
await this.navigateForwardWithSingleCarMatch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) {
|
if (this.selectedVinLookupMethod === vinLookupMethodSelections.MANUALVIN) {
|
||||||
await this.dispatchStoreAction(storeActions.CLEAR_VIN);
|
await this.dispatchStoreAction(storeActions.CLEAR_VIN);
|
||||||
return this.$router.navigateWithSaving(
|
return this.$router.navigateWithSaving(
|
||||||
|
|
@ -323,18 +182,15 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (this.selectedVinLookupMethod === vinLookupMethodSelections.DECLINE) {
|
||||||
|
return this.$router.navigateWithSaving(
|
||||||
|
this.navigationScenarios.SELECTED_NO_VIN,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
AlertNonServiceableZipHeader() {
|
|
||||||
return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll(
|
|
||||||
"{custom:serviceZip}",
|
|
||||||
this.serviceZipCode
|
|
||||||
);
|
|
||||||
},
|
|
||||||
AlertNonServiceableZipBody() {
|
|
||||||
return this.getCmsContent("AlertNonServiceableZipWidget", "BodyText");
|
|
||||||
},
|
|
||||||
questionText() {
|
questionText() {
|
||||||
return this.getCmsContent("VinLookupMethod", "QuestionText");
|
return this.getCmsContent("VinLookupMethod", "QuestionText");
|
||||||
},
|
},
|
||||||
|
|
@ -344,18 +200,10 @@ export default {
|
||||||
isRepair() {
|
isRepair() {
|
||||||
return store.getters.damage.isRepair;
|
return store.getters.damage.isRepair;
|
||||||
},
|
},
|
||||||
alertInfo() {
|
|
||||||
return this.skipVinNotRepair ? "AlertQuoteVinOptional" : "AlertQuoteReady";
|
|
||||||
},
|
|
||||||
VinLookupQuestionText() {
|
VinLookupQuestionText() {
|
||||||
return this.getCmsContent("VinLookupQuestion", "BodyText");
|
return this.getCmsContent("VinLookupQuestion", "BodyText");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
serviceZipCode() {
|
|
||||||
this.displayNonServiceableZipAlert = false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
funnelHeader,
|
funnelHeader,
|
||||||
vehicleBanner,
|
vehicleBanner,
|
||||||
|
|
@ -363,9 +211,6 @@ export default {
|
||||||
navbar,
|
navbar,
|
||||||
buttonQuestion,
|
buttonQuestion,
|
||||||
Form,
|
Form,
|
||||||
alert,
|
|
||||||
textboxQuestion,
|
|
||||||
textBlock,
|
|
||||||
loadingModal,
|
loadingModal,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,10 @@ export default {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.originalList = resultMap.insuranceCompanyList;
|
vm.originalList = resultMap.insuranceCompanyList;
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ import { Form, defineRule } from "vee-validate";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
@ -53,6 +55,10 @@ export default {
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,14 @@ function setupMocks() {
|
||||||
order: {
|
order: {
|
||||||
payment: {
|
payment: {
|
||||||
isPia: false,
|
isPia: false,
|
||||||
|
insuranceCoverage: {
|
||||||
|
isVerified: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
currentDeductible: 123,
|
||||||
|
isNoComp: false,
|
||||||
|
isItac: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
policy: {
|
policy: {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
<hr class="my-0" />
|
<hr class="my-0" />
|
||||||
|
|
||||||
<cart
|
<cart
|
||||||
|
ref="cart"
|
||||||
:damage="damageInfo"
|
:damage="damageInfo"
|
||||||
:availableVaps="availableVaps"
|
:availableVaps="availableVaps"
|
||||||
:allowItemRemoval="true"
|
:allowItemRemoval="true"
|
||||||
|
|
@ -64,12 +65,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<paymentMethodQuestion
|
<paymentMethodQuestion
|
||||||
v-if="!isPiaDisabled"
|
v-if="isPiaEnabled && totalAmountDue > 0"
|
||||||
v-model="paymentMethodInternalModel"
|
v-model="paymentMethodInternalModel"
|
||||||
validationRules="payment-method-required" />
|
validationRules="payment-method-required" />
|
||||||
|
|
||||||
<alert
|
<alert
|
||||||
v-if="isPiaDisabled"
|
v-if="!isPiaEnabled && totalAmountDue > 0"
|
||||||
:isDismissible="false"
|
:isDismissible="false"
|
||||||
alertClass="alert-info"
|
alertClass="alert-info"
|
||||||
cmsWidgetName="NoPiaDisclaimerWidget"
|
cmsWidgetName="NoPiaDisclaimerWidget"
|
||||||
|
|
@ -623,21 +624,21 @@ export default {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isPiaDisabled() {
|
totalAmountDue() {
|
||||||
|
return baseMixin.methods.getAmountDue(this.lineItems);
|
||||||
|
},
|
||||||
|
isPiaEnabled() {
|
||||||
const piaExperience = this.getSettingValue(experimentSettings.PIA_EXPERIENCE);
|
const piaExperience = this.getSettingValue(experimentSettings.PIA_EXPERIENCE);
|
||||||
const piaInsurance = this.getSettingValue(experimentSettings.PIA_INSURANCE);
|
const piaInsurance = this.getSettingValue(experimentSettings.PIA_INSURANCE);
|
||||||
|
|
||||||
var isEnabled = false;
|
|
||||||
if (this.isInsurance) {
|
if (this.isInsurance) {
|
||||||
isEnabled = piaInsurance === "true" && this.currentDeductible !== 0;
|
return piaInsurance === "true" && this.currentDeductible > 0;
|
||||||
} else {
|
} else {
|
||||||
isEnabled = piaExperience === "PIA Optional" || piaExperience === "PIA Required";
|
return piaExperience === "PIA Optional" || piaExperience === "PIA Required";
|
||||||
}
|
}
|
||||||
|
|
||||||
return !isEnabled;
|
|
||||||
},
|
},
|
||||||
paymentMethod() {
|
paymentMethod() {
|
||||||
if (this.isPiaDisabled) {
|
if (!this.isPiaEnabled) {
|
||||||
return paymentMethods.LATER;
|
return paymentMethods.LATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import * as navigateToHeritage from "@/helpers/heritage-integration/navigation-h
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import { containsLineItemWithPartType } from "../../helpers/service-package-helper";
|
||||||
|
|
||||||
jest.mock("@/store", () => ({
|
jest.mock("@/store", () => ({
|
||||||
commit: jest.fn(),
|
commit: jest.fn(),
|
||||||
|
|
@ -22,6 +23,9 @@ jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
||||||
navigateToHeritageFunnel: jest.fn(),
|
navigateToHeritageFunnel: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
jest.mock("@/helpers/service-package-helper", () => ({
|
||||||
|
containsLineItemWithPartType: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
jest.mock("@/helpers/promotions-helper", () => ({
|
jest.mock("@/helpers/promotions-helper", () => ({
|
||||||
revalidatePromosAndValidateQueryStringPromo: jest.fn(() => {
|
revalidatePromosAndValidateQueryStringPromo: jest.fn(() => {
|
||||||
|
|
@ -636,12 +640,122 @@ describe("quote.vue", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe("quote.vue", () => {
|
||||||
|
test("should call forwardButtonAction if isLeadGen is true and Insurance is true", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
|
||||||
|
store.getters = {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
zipCode: "12345",
|
||||||
|
zipCodeCtu: "value",
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
isRepair: false,
|
||||||
|
},
|
||||||
|
referralNumber: "1234567",
|
||||||
|
payment: {
|
||||||
|
isInsurance: true,
|
||||||
|
inactivePromos: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isLeadGen: true,
|
||||||
|
payment: {
|
||||||
|
isInsurance: true,
|
||||||
|
inactivePromos: [],
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
cardId: "123",
|
||||||
|
},
|
||||||
|
experimentSettings: {
|
||||||
|
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.$route = { query: null };
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await quote.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "quote" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
test("should not call forwardButtonAction if isLeadGen is true and Insurance is false", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters = {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
lineItems: {
|
||||||
|
glassParts: ["item", "item2"],
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
zipCode: "12345",
|
||||||
|
zipCodeCtu: "value",
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
isRepair: false,
|
||||||
|
},
|
||||||
|
referralNumber: "1234567",
|
||||||
|
payment: {
|
||||||
|
isInsurance: null,
|
||||||
|
inactivePromos: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isLeadGen: true,
|
||||||
|
payment: {
|
||||||
|
isInsurance: null,
|
||||||
|
inactivePromos: [],
|
||||||
|
},
|
||||||
|
vehicle: {
|
||||||
|
cardId: "123",
|
||||||
|
},
|
||||||
|
experimentSettings: {
|
||||||
|
settingName: "SERVICE_PACKAGE_DISCOUNT",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.$route = { query: null };
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await quote.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "quote" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function setupMocks({ customMountOptions }) {
|
function setupMocks({ customMountOptions }) {
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
...customMountOptions,
|
...customMountOptions,
|
||||||
});
|
});
|
||||||
|
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
||||||
mountOptions.global.mocks["$store"] = store;
|
mountOptions.global.mocks["$store"] = store;
|
||||||
mountOptions["attachTo"] = document.body;
|
mountOptions["attachTo"] = document.body;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||||
<loadingModal ref="loadingModal" />
|
<loadingModal ref="loadingModal" />
|
||||||
<div class="container-fluid page-container-grouped-styles">
|
<div class="container-fluid page-container-grouped-styles quote">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||||
|
|
@ -20,7 +20,10 @@
|
||||||
cmsWidgetName="CashOrInsuranceQuestionWidget"
|
cmsWidgetName="CashOrInsuranceQuestionWidget"
|
||||||
v-model="isInsuranceSelected"
|
v-model="isInsuranceSelected"
|
||||||
groupName="CashOrInsuranceQuestion" />
|
groupName="CashOrInsuranceQuestion" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
<servicePackageQuestion
|
<servicePackageQuestion
|
||||||
ref="servicePackage"
|
ref="servicePackage"
|
||||||
cashCmsWidgetName="CashServicePackageQuestionWidget"
|
cashCmsWidgetName="CashServicePackageQuestionWidget"
|
||||||
|
|
@ -34,14 +37,23 @@
|
||||||
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
v-on="{ 'buttonEvent.openModal': openModalAction }"
|
||||||
validationRules="option-required"
|
validationRules="option-required"
|
||||||
isRequired />
|
isRequired />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
<afterpayModalBanner
|
<afterpayModalBanner
|
||||||
v-if="!isInsuranceSelected"
|
v-if="!isInsuranceSelected && !isRecalibrationOnOrder"
|
||||||
cmsWidgetName="AfterpayModalWidget"
|
cmsWidgetName="AfterpayModalWidget"
|
||||||
:activePromos="lineItems.promos"
|
:activePromos="lineItems.promos"
|
||||||
:availableLineItems="availableLineItems"
|
:availableLineItems="availableLineItems"
|
||||||
:lineItems="lineItems" />
|
:lineItems="lineItems" />
|
||||||
|
|
||||||
|
<recalDisclaimer
|
||||||
|
cmsWidgetName="RecalDisclaimerWidget"
|
||||||
|
v-if="isRecalibrationOnOrder"
|
||||||
|
v-on="{ textLinkClicked: openModalAction }"
|
||||||
|
alertClass="alert-info" />
|
||||||
|
|
||||||
<promoModalQuestion
|
<promoModalQuestion
|
||||||
class="small mt-4"
|
class="small mt-4"
|
||||||
v-model="lineItems"
|
v-model="lineItems"
|
||||||
|
|
@ -60,7 +72,7 @@
|
||||||
<contentGroupModal ref="RainDefenseModal" cmsWidgetName="RainDefenseModal" />
|
<contentGroupModal ref="RainDefenseModal" cmsWidgetName="RainDefenseModal" />
|
||||||
<contentGroupModal ref="FrontWiperModal" cmsWidgetName="FrontWiperModal" />
|
<contentGroupModal ref="FrontWiperModal" cmsWidgetName="FrontWiperModal" />
|
||||||
<contentGroupModal ref="RearWiperModal" cmsWidgetName="RearWiperModal" />
|
<contentGroupModal ref="RearWiperModal" cmsWidgetName="RearWiperModal" />
|
||||||
<contentGroupModal ref="RecalModal" cmsWidgetName="RecalModal" />
|
<contentGroupModal ref="RecalModal" cmsWidgetName="RecalModal" isRecal />
|
||||||
|
|
||||||
<navbar
|
<navbar
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
|
@ -86,6 +98,7 @@ import textBlock from "@/digital-components/text-block/text-block";
|
||||||
import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal";
|
import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal";
|
||||||
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner";
|
import afterpayModalBanner from "@/layouts/quote/afterpay-modal-banner/afterpay-modal-banner";
|
||||||
|
import recalDisclaimer from "@/layouts/quote/recal-disclaimer/recal-disclaimer.vue";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import experimentMixin from "@/mixins/experiment-mixin.js";
|
import experimentMixin from "@/mixins/experiment-mixin.js";
|
||||||
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "../../mixins/vehicle-questions-mixin";
|
||||||
|
|
@ -108,6 +121,8 @@ import { queryStrings } from "@/constants/query-strings";
|
||||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question";
|
import promoModalQuestion from "@/fmg-components/promo-modal-question/promo-modal-question";
|
||||||
import { experimentSettings } from "@/constants/experiments";
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
|
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||||
|
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
||||||
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -182,6 +197,18 @@ export default {
|
||||||
...servicePackageDiscountPart,
|
...servicePackageDiscountPart,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// When calling pricing from the quote page, always use the cash parent account
|
||||||
|
baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
|
||||||
|
applicationConfig.CASH_PARENT_ACCOUNT_NUMBER,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
baseMixin.methods.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_BILL_TO_ACCOUNT_NUMBER,
|
||||||
|
applicationConfig.CASH_DEFAULT_BILL_TO_ACCOUNT_NUMBER,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
{
|
{
|
||||||
|
|
@ -242,6 +269,17 @@ export default {
|
||||||
validateAlerts[0].shouldAutoFade
|
validateAlerts[0].shouldAutoFade
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
if (store.getters.order.payment.isInsurance == true) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -256,6 +294,12 @@ export default {
|
||||||
lineItemsCloneForWatcher() {
|
lineItemsCloneForWatcher() {
|
||||||
return Object.assign({}, this.lineItems);
|
return Object.assign({}, this.lineItems);
|
||||||
},
|
},
|
||||||
|
isRecalibrationOnOrder() {
|
||||||
|
return containsLineItemWithPartType(
|
||||||
|
partTypeStrings.RECALIBRATION,
|
||||||
|
this?.availableLineItems
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModalAction(modalName) {
|
openModalAction(modalName) {
|
||||||
|
|
@ -405,6 +449,7 @@ export default {
|
||||||
loadingModal,
|
loadingModal,
|
||||||
afterpayModalBanner,
|
afterpayModalBanner,
|
||||||
promoModalQuestion,
|
promoModalQuestion,
|
||||||
|
recalDisclaimer,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
51
src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js
Normal file
51
src/layouts/quote/recal-disclaimer/recal-disclaimer.spec.js
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { mount } from "@vue/test-utils";
|
||||||
|
import recalDisclamer from "./recal-disclaimer";
|
||||||
|
|
||||||
|
describe("recal-disclaimer.vue", () => {
|
||||||
|
it("Should display header text when HeaderText is defined in the CMS", async () => {
|
||||||
|
const wrapper = mount(recalDisclamer, {
|
||||||
|
mixins: [mockMixin],
|
||||||
|
props: {
|
||||||
|
cmsWidgetName: "test",
|
||||||
|
},
|
||||||
|
attachTo: document.body,
|
||||||
|
});
|
||||||
|
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["HeaderText"]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should insert image url when Image is defined in the CMS", async () => {
|
||||||
|
const wrapper = mount(recalDisclamer, {
|
||||||
|
mixins: [mockMixin],
|
||||||
|
props: {
|
||||||
|
cmsWidgetName: "test",
|
||||||
|
},
|
||||||
|
attachTo: document.body,
|
||||||
|
});
|
||||||
|
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["Image"]));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should display subheader text when SubheaderText is defined in the CMS", async () => {
|
||||||
|
const wrapper = mount(recalDisclamer, {
|
||||||
|
mixins: [mockMixin],
|
||||||
|
props: {
|
||||||
|
cmsWidgetName: "test",
|
||||||
|
},
|
||||||
|
attachTo: document.body,
|
||||||
|
});
|
||||||
|
expect(wrapper.html()).toEqual(expect.stringContaining(mockCmsContent["SubheaderText"]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const mockMixin = {
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn((widgetName, cmsFieldName) => {
|
||||||
|
return mockCmsContent[cmsFieldName];
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const mockCmsContent = {
|
||||||
|
HeaderText: "Sample header text here.",
|
||||||
|
SubheaderText: "Sample subheader text here.",
|
||||||
|
Image: "https://www.sampleImage.sample",
|
||||||
|
};
|
||||||
115
src/layouts/quote/recal-disclaimer/recal-disclaimer.vue
Normal file
115
src/layouts/quote/recal-disclaimer/recal-disclaimer.vue
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
<template>
|
||||||
|
<div class="alert fade show alert-info recal-alert" role="alert">
|
||||||
|
<div class="alert-heading">
|
||||||
|
<span>
|
||||||
|
<img v-if="hasImage" :src="imageUrl" />
|
||||||
|
<span class="px-2"> {{ recalHeaderText }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span v-for="copy in recalBody" :key="copy">
|
||||||
|
<span v-if="doesCopyContainTextLink(copy)" class="recal-link">
|
||||||
|
<textLink
|
||||||
|
linkType="text"
|
||||||
|
:text="getRouterLinkDisplayTextFromCopy(copy)"
|
||||||
|
href="#!"
|
||||||
|
@click-event="$emit('textLinkClicked', getRouterLinkRouteFromCopy(copy))"
|
||||||
|
:data-bs-target="'#' + getRouterLinkRouteFromCopy(copy)" />
|
||||||
|
</span>
|
||||||
|
<span v-else v-html="copy" class="alert-body"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import textLink from "@/ux-components/text-link/text-link";
|
||||||
|
|
||||||
|
// Supporting files
|
||||||
|
import {
|
||||||
|
doesCopyContainTextLink,
|
||||||
|
splitCopyOnCMSPlaceHolder,
|
||||||
|
getRouterLinkRouteFromCopy,
|
||||||
|
getRouterLinkDisplayTextFromCopy,
|
||||||
|
getExternalLink,
|
||||||
|
} from "@/helpers/cms-content-helper";
|
||||||
|
|
||||||
|
function getInlineAltText(token) {
|
||||||
|
const innerTokens = token.split(",");
|
||||||
|
|
||||||
|
return innerTokens[1] ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "recal-disclaimer",
|
||||||
|
props: {
|
||||||
|
cmsWidgetName: String,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getInlineAltText,
|
||||||
|
doesCopyContainTextLink,
|
||||||
|
splitCopyOnCMSPlaceHolder,
|
||||||
|
getRouterLinkRouteFromCopy,
|
||||||
|
getRouterLinkDisplayTextFromCopy,
|
||||||
|
getExternalLink,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
imageUrl() {
|
||||||
|
return this.getCmsContent(this.cmsWidgetName, "Image");
|
||||||
|
},
|
||||||
|
hasImage() {
|
||||||
|
return !!this.imageUrl;
|
||||||
|
},
|
||||||
|
recalHeaderText() {
|
||||||
|
return this.getCmsContent(this.cmsWidgetName, "HeaderText");
|
||||||
|
},
|
||||||
|
recalBody() {
|
||||||
|
return splitCopyOnCMSPlaceHolder(
|
||||||
|
this.getCmsContent(this.cmsWidgetName, "SubheaderText")
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
textLink,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.alert {
|
||||||
|
text-align: center;
|
||||||
|
&.recal-alert {
|
||||||
|
padding: 16px 18px;
|
||||||
|
}
|
||||||
|
&.alert-info {
|
||||||
|
background-color: #e5f1fa;
|
||||||
|
color: #525656;
|
||||||
|
.alert-heading {
|
||||||
|
color: #0070d1;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 17.3px;
|
||||||
|
}
|
||||||
|
svg {
|
||||||
|
fill: #0070d1;
|
||||||
|
width: 1rem;
|
||||||
|
height: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& .alert-heading {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.alert-body {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400px;
|
||||||
|
}
|
||||||
|
.recal-link {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -234,10 +234,15 @@ export default {
|
||||||
},
|
},
|
||||||
getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) {
|
getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) {
|
||||||
var lineItemsToPrice = [...this.nullSafeAvailableLineItems];
|
var lineItemsToPrice = [...this.nullSafeAvailableLineItems];
|
||||||
|
if (this.isRecalibrationOnOrder) {
|
||||||
|
lineItemsToPrice = lineItemsToPrice.filter((item) => {
|
||||||
|
return item.partType != partTypeStrings.RECALIBRATION;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//remove service package discount part
|
//remove service package discount part
|
||||||
if (this.isServicePackageDiscountOnOrder) {
|
if (this.isServicePackageDiscountOnOrder) {
|
||||||
lineItemsToPrice = this.nullSafeAvailableLineItems.filter((item) => {
|
lineItemsToPrice = lineItemsToPrice.filter((item) => {
|
||||||
return item.partType != this.servicePackageDiscountParts[0].partType;
|
return item.partType != this.servicePackageDiscountParts[0].partType;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@
|
||||||
]"
|
]"
|
||||||
for="testradio">
|
for="testradio">
|
||||||
<div class="package-specs">
|
<div class="package-specs">
|
||||||
<div v-if="this.additionalButtonData.servicePackageDiscount" class="row">
|
<div
|
||||||
|
v-if="this.additionalButtonData.servicePackageDiscount"
|
||||||
|
class="row justify-content-between">
|
||||||
<div class="col md-6">
|
<div class="col md-6">
|
||||||
<p class="m-0">
|
<p class="m-0">
|
||||||
<span v-html="this.buttonLabel"></span>
|
<span v-html="this.buttonLabel"></span>
|
||||||
|
|
@ -136,24 +138,20 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.discount-text {
|
|
||||||
line-height: 36px;
|
|
||||||
display: flex;
|
|
||||||
border-top-right-radius: 0.5rem;
|
|
||||||
border-top-left-radius: 0.5rem;
|
|
||||||
background-color: #469d2a;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 5px;
|
|
||||||
width: 100%;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.package-main {
|
.package-main {
|
||||||
.package-wrapper {
|
.package-wrapper {
|
||||||
margin: 0.5rem 0;
|
margin: 1rem 0;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
}
|
||||||
|
position: relative;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
margin: 1rem 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="radio"] {
|
input[type="radio"] {
|
||||||
|
|
@ -174,13 +172,21 @@ export default {
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 60px;
|
min-height: 60px;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
max-height: 500px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
&.has-subheader {
|
&.has-subheader {
|
||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
}
|
}
|
||||||
&.has-text {
|
&.has-text {
|
||||||
border-radius: 0 0 0.5rem 0.5rem;
|
border-radius: 0 0 0.5rem 0.5rem;
|
||||||
border: 1px solid #469d2a !important;
|
border: 1px solid #469d2a;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
padding-top: 3.75rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
|
|
@ -265,6 +271,9 @@ export default {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 0;
|
max-height: 0;
|
||||||
transition: all 0.5s ease;
|
transition: all 0.5s ease;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
max-height: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|
@ -337,6 +346,34 @@ export default {
|
||||||
|
|
||||||
.hide-when-closed {
|
.hide-when-closed {
|
||||||
display: none;
|
display: none;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.discount-text {
|
||||||
|
line-height: 36px;
|
||||||
|
display: flex;
|
||||||
|
border-top-right-radius: 0.5rem;
|
||||||
|
border-top-left-radius: 0.5rem;
|
||||||
|
background-color: #469d2a;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 5px;
|
||||||
|
width: 100%;
|
||||||
|
color: white;
|
||||||
|
height: 2.875rem;
|
||||||
|
@include media-breakpoint-up(md) {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
~ label {
|
||||||
|
.package-label {
|
||||||
|
&:after {
|
||||||
|
top: 68px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,6 @@
|
||||||
{{ errorMessage }}
|
{{ errorMessage }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<textBlock
|
|
||||||
v-if="mobileFeeApplies"
|
|
||||||
:customText="mobileFeeText"
|
|
||||||
cmsWidgetName="MobileFeeDisclaimerWidget"
|
|
||||||
typeStyle="caption" />
|
|
||||||
</div>
|
</div>
|
||||||
<modal
|
<modal
|
||||||
:ref="modalName"
|
:ref="modalName"
|
||||||
|
|
@ -154,7 +149,6 @@ export default {
|
||||||
alertInvalidZipWidgetName: String,
|
alertInvalidZipWidgetName: String,
|
||||||
customComponentId: String,
|
customComponentId: String,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
mobileFeeApplies: Boolean,
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mobileLocationLinkPromptText() {
|
mobileLocationLinkPromptText() {
|
||||||
|
|
@ -182,21 +176,6 @@ export default {
|
||||||
modalHeaderText() {
|
modalHeaderText() {
|
||||||
return this.getCmsContent(this.modalWidgetName, "HeaderText");
|
return this.getCmsContent(this.modalWidgetName, "HeaderText");
|
||||||
},
|
},
|
||||||
mobileFeeText() {
|
|
||||||
const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text");
|
|
||||||
return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee);
|
|
||||||
},
|
|
||||||
mobileFee() {
|
|
||||||
if (!this.mobileFeePart) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
this.mobileFeePart.laborAmount +
|
|
||||||
this.mobileFeePart.sellingPrice +
|
|
||||||
this.mobileFeePart.kitPrice
|
|
||||||
);
|
|
||||||
},
|
|
||||||
modalFooterText() {
|
modalFooterText() {
|
||||||
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,12 @@
|
||||||
cmsWidgetName="AlertNoShopsWidget"
|
cmsWidgetName="AlertNoShopsWidget"
|
||||||
v-if="displayNoShopsAlert"
|
v-if="displayNoShopsAlert"
|
||||||
alertClass="alert-warning" />
|
alertClass="alert-warning" />
|
||||||
|
<alert
|
||||||
|
ref="alertMobileFeeFree"
|
||||||
|
class="my-5"
|
||||||
|
cmsWidgetName="AlertMobileFeeFreeWidget"
|
||||||
|
v-if="isServiceableMobile && !isInsurance"
|
||||||
|
alertClass="alert-success" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center appointment-type">
|
<div class="row justify-content-center appointment-type">
|
||||||
|
|
@ -81,7 +87,6 @@
|
||||||
v-if="selectedAppointmentType === 'Mobile'"
|
v-if="selectedAppointmentType === 'Mobile'"
|
||||||
v-model="mobileLocationQuestions"
|
v-model="mobileLocationQuestions"
|
||||||
:mobileFeePart="mobileFeePart"
|
:mobileFeePart="mobileFeePart"
|
||||||
:mobileFeeApplies="mobileFeeApplies"
|
|
||||||
@updated-mobile-fee-part="setMobileFeePart"
|
@updated-mobile-fee-part="setMobileFeePart"
|
||||||
@updated-serviceability="setServiceabilityDetails"
|
@updated-serviceability="setServiceabilityDetails"
|
||||||
@updated-contains-military-base="setContainsMilitaryBase"
|
@updated-contains-military-base="setContainsMilitaryBase"
|
||||||
|
|
@ -355,6 +360,9 @@ export default {
|
||||||
recalibrationInformationModal() {
|
recalibrationInformationModal() {
|
||||||
return this.$refs.recalibrationInformationModal;
|
return this.$refs.recalibrationInformationModal;
|
||||||
},
|
},
|
||||||
|
isInsurance() {
|
||||||
|
return store.getters.payment.isInsurance;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
|
|
|
||||||
488
src/layouts/service-zip/service-zip.spec.js
Normal file
488
src/layouts/service-zip/service-zip.spec.js
Normal file
|
|
@ -0,0 +1,488 @@
|
||||||
|
// Components
|
||||||
|
import serviceZip from "@/layouts/service-zip/service-zip";
|
||||||
|
|
||||||
|
// Supporting Files
|
||||||
|
import { shallowMount } from "@vue/test-utils";
|
||||||
|
import { getMountOptions } from "@/helpers/unit-test-helper";
|
||||||
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
import store from "@/store";
|
||||||
|
import router from "@/router";
|
||||||
|
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||||
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
|
||||||
|
// Setup global mocks
|
||||||
|
let mockCmsContent = {
|
||||||
|
AlertNonServiceableZipWidget: {
|
||||||
|
HeadlineText: "Test",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let mockStoreActionData = {};
|
||||||
|
|
||||||
|
let mockStoreData = {};
|
||||||
|
|
||||||
|
function resetMockStoreData() {
|
||||||
|
mockStoreData = {
|
||||||
|
vehicle: {
|
||||||
|
year: "2000",
|
||||||
|
make: "TestMake",
|
||||||
|
model: "TestModel",
|
||||||
|
style: "TestStyle",
|
||||||
|
carId: "TestID",
|
||||||
|
vin: null,
|
||||||
|
registration: {
|
||||||
|
licensePlate: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
serviceLocation: {
|
||||||
|
address: null,
|
||||||
|
address2: null,
|
||||||
|
city: null,
|
||||||
|
state: null,
|
||||||
|
zipCode: null,
|
||||||
|
zipCodeCtu: null,
|
||||||
|
appointmentType: null,
|
||||||
|
isVehicleProtected: null,
|
||||||
|
provider: {
|
||||||
|
providerNumber: null,
|
||||||
|
address: {
|
||||||
|
streetAddress: null,
|
||||||
|
city: null,
|
||||||
|
state: null,
|
||||||
|
zipCode: null,
|
||||||
|
zipCodeCtu: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
techNotes: null,
|
||||||
|
},
|
||||||
|
customer: {
|
||||||
|
firstName: null,
|
||||||
|
lastName: null,
|
||||||
|
emailAddress: null,
|
||||||
|
phoneNumber: null,
|
||||||
|
isSmsOptIn: null,
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
isRepair: false,
|
||||||
|
numberOfChips: null,
|
||||||
|
glassToReplace: [{ glassLocation: "Windshield", glassName: "windshield" }],
|
||||||
|
partQuestionAnswers: null,
|
||||||
|
moldingQuestionAnswers: null,
|
||||||
|
capabilityQuestionAnswers: null,
|
||||||
|
dateOfLoss: null,
|
||||||
|
damageCause: null,
|
||||||
|
},
|
||||||
|
lineItems: {
|
||||||
|
glassParts: [
|
||||||
|
{
|
||||||
|
canSafeliteRecalibrate: true,
|
||||||
|
childParts: [
|
||||||
|
{
|
||||||
|
kitPrice: 0,
|
||||||
|
laborAmount: 23.55,
|
||||||
|
partNumber: "GGG FW4896",
|
||||||
|
salesTax: 1.77,
|
||||||
|
sellingPrice: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
color: "Green Tint",
|
||||||
|
description:
|
||||||
|
"solar, soundproofing, lane keep assist, lane departure warning system, w/adaptive cruise control",
|
||||||
|
id: "db22fd44-10dd-456f-979b-ff88cf68cca6",
|
||||||
|
kitPrice: 0,
|
||||||
|
laborAmount: 60,
|
||||||
|
partNumber: "FW04896GTYN",
|
||||||
|
partType: "WINDSHIELD",
|
||||||
|
recalibrationType: "STATIC",
|
||||||
|
requiresCapabilityQuestions: false,
|
||||||
|
requiresRecalibration: true,
|
||||||
|
salesTax: 63.86,
|
||||||
|
sellingPrice: 791.46,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
supportingItems: null,
|
||||||
|
vaps: null,
|
||||||
|
serverData: null,
|
||||||
|
promos: null,
|
||||||
|
},
|
||||||
|
payment: {
|
||||||
|
isInsurance: null,
|
||||||
|
insuranceCoverage: {
|
||||||
|
isVerified: null,
|
||||||
|
coverageStatus: null,
|
||||||
|
coverageType: null,
|
||||||
|
coverageVerificationType: null,
|
||||||
|
},
|
||||||
|
parentAccountNumber: 0,
|
||||||
|
billToAccountNumber: null,
|
||||||
|
isPia: null,
|
||||||
|
piaType: null,
|
||||||
|
inactivePromos: null,
|
||||||
|
paypalToken: null,
|
||||||
|
nextGenSettledAmount: 0,
|
||||||
|
ccToken: {
|
||||||
|
subscriptionId: null,
|
||||||
|
expMonth: null,
|
||||||
|
expYear: null,
|
||||||
|
cardType: null,
|
||||||
|
billToPostalCode: null,
|
||||||
|
billToFirstName: null,
|
||||||
|
billToLastName: null,
|
||||||
|
referenceNumber: null,
|
||||||
|
authCode: null,
|
||||||
|
transactionId: null,
|
||||||
|
transReferenceNumber: null,
|
||||||
|
lastFour: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
policy: {
|
||||||
|
currentDeductible: 0,
|
||||||
|
policyNumber: null,
|
||||||
|
isItac: false,
|
||||||
|
additionalAuthFlag: null,
|
||||||
|
isNoComp: false,
|
||||||
|
insuranceCompanyName: null,
|
||||||
|
},
|
||||||
|
schedule: {
|
||||||
|
date: null,
|
||||||
|
startTime: null,
|
||||||
|
endTime: null,
|
||||||
|
routeCode: null,
|
||||||
|
jobMaxMinutes: null,
|
||||||
|
jobMinMinutes: null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyMockStoreDataToGetters() {
|
||||||
|
store.getters = {
|
||||||
|
order: mockStoreData,
|
||||||
|
damage: mockStoreData.damage,
|
||||||
|
payment: mockStoreData.payment,
|
||||||
|
policy: mockStoreData.policy,
|
||||||
|
};
|
||||||
|
store.state.order = mockStoreData;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function mockDispatchStoreAction(actionName) {
|
||||||
|
return mockStoreActionData[actionName];
|
||||||
|
}
|
||||||
|
|
||||||
|
jest.mock("@/mixins/base-mixin.js", () => ({
|
||||||
|
methods: {
|
||||||
|
dispatchStoreAction: jest.fn().mockImplementation(mockDispatchStoreAction),
|
||||||
|
dispatchStoreActionWithLogging: jest.fn().mockImplementation(mockDispatchStoreAction),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
|
fetchCmsContentForPage: () => Promise.resolve("content"),
|
||||||
|
}));
|
||||||
|
|
||||||
|
jest.mock("@/helpers/heritage-integration/order-helper.js", () => ({
|
||||||
|
saveSession: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.navigateWithoutSaving = jest.fn();
|
||||||
|
router.navigateWithSaving = jest.fn();
|
||||||
|
|
||||||
|
// Tests
|
||||||
|
describe("service-zip.vue", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
resetMockStoreData();
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Pre-existing fields", () => {
|
||||||
|
test("No existing fields -> serviceZip & emailAdress undefined", () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.serviceZipCode).toBeFalsy();
|
||||||
|
expect(wrapper.vm.emailAddress).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Fields in store -> autofilled to data", () => {
|
||||||
|
// Arrange
|
||||||
|
mockStoreData.serviceLocation.zipCode = "11111";
|
||||||
|
mockStoreData.customer.emailAddress = "builddigitaltest@safelite.com";
|
||||||
|
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.serviceZipCode).toEqual("11111");
|
||||||
|
expect(wrapper.vm.emailAddress).toEqual("builddigitaltest@safelite.com");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Zip in querystring -> pushed to data", () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({
|
||||||
|
customZipQuery: "11111",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.serviceZipCode).toEqual("11111");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Navigation", () => {
|
||||||
|
describe("Back Nav", () => {
|
||||||
|
test("If skipvin eligable, go back to vehicle-damage", async () => {
|
||||||
|
// Arrange
|
||||||
|
mockStoreData.damage.isRepair = true;
|
||||||
|
mockStoreData.damage.numberOfChips = 1;
|
||||||
|
mockStoreData.damage.glassToReplace = null;
|
||||||
|
mockStoreData.lineItems.glassParts = null;
|
||||||
|
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
await wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||||
|
navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN,
|
||||||
|
wrapper.vm.$route
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("If not skipvin eligable, go back to estimate", async () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
await wrapper.vm.backButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithoutSaving).toBeCalledWith(
|
||||||
|
navigationScenarios.CLICKED_BACK,
|
||||||
|
wrapper.vm.$route
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Forward Nav", () => {
|
||||||
|
test("Repair skips questions flow", async () => {
|
||||||
|
// Arrange
|
||||||
|
mockStoreData.damage.isRepair = true;
|
||||||
|
mockStoreData.damage.numberOfChips = 1;
|
||||||
|
mockStoreData.damage.glassToReplace = null;
|
||||||
|
mockStoreData.lineItems.glassParts = null;
|
||||||
|
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
|
||||||
|
jest.spyOn(wrapper.vm, "navigateForwardWithSingleCarMatch").mockImplementation();
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithSaving).toBeCalledWith(
|
||||||
|
navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||||
|
wrapper.vm.$route
|
||||||
|
);
|
||||||
|
expect(wrapper.vm.navigateForwardWithSingleCarMatch).not.toBeCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Non-repair enters questions flow", async () => {
|
||||||
|
// Arrange
|
||||||
|
mockStoreData.damage.isRepair = false;
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
|
||||||
|
jest.spyOn(wrapper.vm, "navigateForwardWithSingleCarMatch").mockImplementation();
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigateWithSaving).not.toBeCalled();
|
||||||
|
expect(wrapper.vm.navigateForwardWithSingleCarMatch).toBeCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Alerts", () => {
|
||||||
|
test("Invalid zip alert shown if indicated by endpoint", async () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
const invalidZipResponse = {
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "TESTCTU",
|
||||||
|
isValid: false,
|
||||||
|
isServiceable: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({ customZipDataResponse: invalidZipResponse });
|
||||||
|
|
||||||
|
wrapper.vm.$refs.navbar.removeLoader = jest.fn();
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.displayInvalidZipAlert).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Non-serviceable zip alert shown if indicated by endpoint", async () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
const invalidZipResponse = {
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "TESTCTU",
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({ customZipDataResponse: invalidZipResponse });
|
||||||
|
|
||||||
|
wrapper.vm.$refs.navbar.removeLoader = jest.fn();
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.displayNonServiceableZipAlert).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Alerts cleared when valid zip is submitted", async () => {
|
||||||
|
// Arrange
|
||||||
|
// no changes to store
|
||||||
|
applyMockStoreDataToGetters();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
|
||||||
|
wrapper.vm.displayInvalidZipAlert = true;
|
||||||
|
wrapper.vm.displayNonServiceableZipAlert = true;
|
||||||
|
|
||||||
|
jest.spyOn(wrapper.vm, "navigateForwardWithSingleCarMatch").mockImplementation();
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.displayInvalidZipAlert).toBe(false);
|
||||||
|
expect(wrapper.vm.displayNonServiceableZipAlert).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("service-zip.vue", () => {
|
||||||
|
test("should call forwardButtonAction if isLeadGen is true and form is valid", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters.isLeadGen = true;
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mock the isFormValid method
|
||||||
|
wrapper.vm.isFormValid = jest.fn().mockImplementation(() => {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await serviceZip.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "service-zip" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
test("should not call forwardButtonAction if isLeadGen is true and form is invalid", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters.isLeadGen = true;
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const wrapper = setupMocks({});
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mock the isFormValid method
|
||||||
|
wrapper.vm.isFormValid = jest.fn().mockImplementation(() => {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await serviceZip.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "service-zip" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupMocks({ customMountOptions, customZipQuery, customZipDataResponse }) {
|
||||||
|
const route = { query: { fmgPage: "service-zip" }, params: {} };
|
||||||
|
if (customZipQuery) {
|
||||||
|
route.query.zipcode = customZipQuery;
|
||||||
|
}
|
||||||
|
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
...customMountOptions,
|
||||||
|
route: route,
|
||||||
|
});
|
||||||
|
|
||||||
|
mountOptions.global.mocks["$store"] = store;
|
||||||
|
mountOptions.global.mocks["$router"] = router;
|
||||||
|
mountOptions.mixins = [
|
||||||
|
{
|
||||||
|
methods: {
|
||||||
|
getCmsContent: jest.fn().mockImplementation((widgetName, fieldName) => {
|
||||||
|
if (mockCmsContent[widgetName] && mockCmsContent[widgetName][fieldName])
|
||||||
|
return mockCmsContent[widgetName][fieldName];
|
||||||
|
}),
|
||||||
|
setCmsContent: jest.fn(),
|
||||||
|
navigateForwardWithSingleCarMatch: jest.fn(),
|
||||||
|
getZipCodeData: jest.fn().mockImplementation(() => {
|
||||||
|
if (customZipDataResponse) {
|
||||||
|
return customZipDataResponse;
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
state: "OH",
|
||||||
|
zipCodeCtu: "TESTCTU",
|
||||||
|
isValid: true,
|
||||||
|
isServiceable: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const wrapper = shallowMount(serviceZip, mountOptions);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
304
src/layouts/service-zip/service-zip.vue
Normal file
304
src/layouts/service-zip/service-zip.vue
Normal file
|
|
@ -0,0 +1,304 @@
|
||||||
|
<template>
|
||||||
|
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||||
|
<loadingModal ref="loadingModal" />
|
||||||
|
<div class="container-fluid page-container-grouped-styles">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<funnelHeader cmsWidgetName="FunnelHeaderWidget" ref="funnelHeader" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6 col-xl-4">
|
||||||
|
<vehicleBanner cmsWidgetName="VehicleBannerWidget" />
|
||||||
|
<funnelSubHeader class="pb-4" cmsWidgetName="FunnelSubHeaderWidget" />
|
||||||
|
<div>
|
||||||
|
<textboxQuestion
|
||||||
|
class="mb-4"
|
||||||
|
cmsWidgetName="ServiceZipQuestionWidget"
|
||||||
|
v-model="serviceZipCode"
|
||||||
|
inputId="serviceZipCode"
|
||||||
|
mask="#####"
|
||||||
|
isRequired
|
||||||
|
validationRules="zip-required|zip-format" />
|
||||||
|
|
||||||
|
<textboxQuestion
|
||||||
|
class="mb-0"
|
||||||
|
cmsWidgetName="EmailAddressQuestionWidget"
|
||||||
|
v-model="emailAddress"
|
||||||
|
inputId="emailAddress"
|
||||||
|
:isRequired="!IsEmailOptional"
|
||||||
|
disableAutoFill
|
||||||
|
:validationRules="EmailValidationRules"
|
||||||
|
:addOptionalText="IsEmailOptional" />
|
||||||
|
<textBlock cmsWidgetName="QuoteEmailTextBlockWidget" typeStyle="caption" />
|
||||||
|
|
||||||
|
<alert
|
||||||
|
ref="alertInvalidZip"
|
||||||
|
v-if="displayInvalidZipAlert"
|
||||||
|
class="my-4"
|
||||||
|
cmsWidgetName="AlertInvalidZipWidget"
|
||||||
|
alertClass="alert-danger"
|
||||||
|
v-bind:isDismissible="false" />
|
||||||
|
|
||||||
|
<alert
|
||||||
|
class="my-4"
|
||||||
|
:manualHeadline="AlertNonServiceableZipHeader"
|
||||||
|
:manualCopy="AlertNonServiceableZipBody"
|
||||||
|
v-model="customAlertData"
|
||||||
|
v-if="displayNonServiceableZipAlert"
|
||||||
|
alertClass="alert-danger" />
|
||||||
|
|
||||||
|
<navbar
|
||||||
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
|
ref="navbar"
|
||||||
|
:isForwardActionDisabled="!meta.valid"
|
||||||
|
@back-clicked="backButtonAction"
|
||||||
|
@ForwardClicked="forwardButtonAction" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Components
|
||||||
|
import funnelHeader from "@/fmg-components/funnel-header/funnel-header";
|
||||||
|
import navbar from "@/fmg-components/nav-bar/nav-bar";
|
||||||
|
import vehicleBanner from "@/fmg-components/vehicle-banner/vehicle-banner";
|
||||||
|
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
|
||||||
|
import buttonQuestion from "@/digital-components/button-question/button-question";
|
||||||
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import textboxQuestion from "@/digital-components/textbox-question/textbox-question";
|
||||||
|
import textBlock from "@/digital-components/text-block/text-block";
|
||||||
|
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
|
||||||
|
|
||||||
|
//Supporting Files
|
||||||
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
import { required, regex } from "@/helpers/validation-rules";
|
||||||
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
|
import { Form, defineRule } from "vee-validate";
|
||||||
|
import store from "@/store";
|
||||||
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
|
import {
|
||||||
|
skipVinLookup,
|
||||||
|
skipVinLookupNotRepair,
|
||||||
|
} from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
|
||||||
|
// Define Validation Rules
|
||||||
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT));
|
||||||
|
defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED));
|
||||||
|
defineRule(
|
||||||
|
"email-address-format",
|
||||||
|
regex(
|
||||||
|
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9-]+)\.([a-zA-Z]{2,})$/,
|
||||||
|
errorMessages.EMAIL_ADDRESS_FORMAT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "service-zip",
|
||||||
|
mixins: [vinPagesMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
serviceZipCode: this.getZipFromStore() ?? this.$route.query.zipcode,
|
||||||
|
emailAddress: this.getEmailFromStore(),
|
||||||
|
displayInvalidZipAlert: false,
|
||||||
|
displayNonServiceableZipAlert: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
async beforeRouteEnter(to, from, next) {
|
||||||
|
//Call APIs
|
||||||
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
||||||
|
//Settle promises and get results
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "cmsContent",
|
||||||
|
promise: cmsContentPromise,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
|
next(async (vm) => {
|
||||||
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
const isValid = await vm.isFormValid();
|
||||||
|
if (isValid) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getZipFromStore() {
|
||||||
|
return store.getters.order.serviceLocation.zipCode;
|
||||||
|
},
|
||||||
|
getEmailFromStore() {
|
||||||
|
return store.getters.order.customer.emailAddress;
|
||||||
|
},
|
||||||
|
arePagePrerequisitesValid() {
|
||||||
|
return store.getters.damage.isRepair || store.getters.damage.glassToReplace?.length > 0;
|
||||||
|
},
|
||||||
|
async backButtonAction() {
|
||||||
|
const skipVin = await skipVinLookup();
|
||||||
|
// route to move backwards
|
||||||
|
if (skipVin) {
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$router.navigateWithoutSaving(
|
||||||
|
this.navigationScenarios.CLICKED_BACK,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async forwardButtonAction() {
|
||||||
|
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
|
||||||
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
|
||||||
|
await this.dispatchStoreAction(
|
||||||
|
storeActions.SAVE_SERVICE_ZIP_CODE_INFO,
|
||||||
|
{
|
||||||
|
zipCode: this.serviceZipCode,
|
||||||
|
state: zipCodeData.state,
|
||||||
|
zipCodeCtu: zipCodeData.zipCodeCtu,
|
||||||
|
},
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!zipCodeData.isValid) {
|
||||||
|
this.displayInvalidZipAlert = true;
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
return this.$refs.navbar.removeLoader();
|
||||||
|
}
|
||||||
|
this.displayInvalidZipAlert = false;
|
||||||
|
|
||||||
|
if (!zipCodeData.isServiceable) {
|
||||||
|
this.displayNonServiceableZipAlert = true;
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
return this.$refs.navbar.removeLoader();
|
||||||
|
}
|
||||||
|
this.displayNonServiceableZipAlert = false;
|
||||||
|
|
||||||
|
const payment = this.$store.getters.payment;
|
||||||
|
const policy = this.$store.getters.policy;
|
||||||
|
|
||||||
|
const vehicleChangedDuringPolicyLookupInHeritage =
|
||||||
|
payment.isInsurance &&
|
||||||
|
payment.insuranceCoverage.coverageStatus &&
|
||||||
|
policy.policyNumber !== "";
|
||||||
|
|
||||||
|
if (vehicleChangedDuringPolicyLookupInHeritage) {
|
||||||
|
navigateToHeritageFunnel({
|
||||||
|
shouldSaveSession: true,
|
||||||
|
pageNameToLog: "estimate",
|
||||||
|
});
|
||||||
|
} else if (this.$store.getters.order.referralNumber?.length === 6) {
|
||||||
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
|
} else if (this.isRepair) {
|
||||||
|
const supportingItemsPromise = await this.dispatchStoreActionWithLogging(
|
||||||
|
storeActions.GET_SUPPORTING_ITEMS,
|
||||||
|
null,
|
||||||
|
"estimate"
|
||||||
|
);
|
||||||
|
|
||||||
|
const promiseResultMap = [
|
||||||
|
{
|
||||||
|
resultKey: "supportingItems",
|
||||||
|
promise: supportingItemsPromise,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
|
this.dispatchStoreAction(
|
||||||
|
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||||
|
resultMap.supportingItems,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
// call saveSession here - navigateWithSaving saves too late in the flow
|
||||||
|
await saveSession({ pageNameToLog: "estimate" });
|
||||||
|
return this.$router.navigateWithSaving(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// if we're skipping the vin-lookup but it's not a repair, we still need to get the parts
|
||||||
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async isFormValid() {
|
||||||
|
const form = this.$refs.theForm;
|
||||||
|
const formValidateResponse = await form.validate();
|
||||||
|
return formValidateResponse?.valid;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
AlertNonServiceableZipHeader() {
|
||||||
|
return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll(
|
||||||
|
"{custom:serviceZip}",
|
||||||
|
this.serviceZipCode
|
||||||
|
);
|
||||||
|
},
|
||||||
|
AlertNonServiceableZipBody() {
|
||||||
|
return this.getCmsContent("AlertNonServiceableZipWidget", "BodyText");
|
||||||
|
},
|
||||||
|
isRepair() {
|
||||||
|
return store.getters.damage.isRepair;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
serviceZipCode() {
|
||||||
|
this.displayNonServiceableZipAlert = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
funnelHeader,
|
||||||
|
vehicleBanner,
|
||||||
|
funnelSubHeader,
|
||||||
|
navbar,
|
||||||
|
Form,
|
||||||
|
alert,
|
||||||
|
textboxQuestion,
|
||||||
|
textBlock,
|
||||||
|
loadingModal,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.vinlookupquestion p {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.vinlookupquestion strong {
|
||||||
|
font-weight: 500;
|
||||||
|
color: $black;
|
||||||
|
}
|
||||||
|
.vinlookupquestion p:nth-child(2) {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -52,6 +52,21 @@ jest.mock("@/store", () => ({
|
||||||
damage: {
|
damage: {
|
||||||
glassToReplace: [],
|
glassToReplace: [],
|
||||||
},
|
},
|
||||||
|
order: {
|
||||||
|
vehicle: {
|
||||||
|
carId: "C00000000",
|
||||||
|
image: "test.jpg",
|
||||||
|
payment: {
|
||||||
|
insuranceCoverage: {
|
||||||
|
isVerified: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
damage: {
|
||||||
|
glassToReplace: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
isLeadGen: false,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
@ -746,6 +761,56 @@ describe("vehicle-damage.vue", () => {
|
||||||
expect(wrapper.vm.shouldHideBackButton).toBeFalsy();
|
expect(wrapper.vm.shouldHideBackButton).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("vehicle-damage.vue", () => {
|
||||||
|
test("should call forwardButtonAction if isLeadGen is true and selectedDamageLocations is not empty", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters.isLeadGen = true;
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set selectedDamageLocations
|
||||||
|
wrapper.setData({ selectedDamageLocations: ["windshield"] });
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
test("should not call forwardButtonAction if isLeadGen is true and selectedDamageLocations is empty", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters.isLeadGen = true;
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set selectedDamageLocations to empty
|
||||||
|
wrapper.setData({ selectedDamageLocations: [] });
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await vehicleDamage.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-damage" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCookie = {} }) {
|
function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCookie = {} }) {
|
||||||
|
|
@ -769,6 +834,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
isVerified: false,
|
isVerified: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
isLeadGen: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -781,6 +847,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
//Mock api responses
|
//Mock api responses
|
||||||
baseMixin.methods.dispatchStoreAction = jest.fn();
|
baseMixin.methods.dispatchStoreAction = jest.fn();
|
||||||
baseMixin.methods.dispatchStoreActionWithLogging = jest.fn();
|
baseMixin.methods.dispatchStoreActionWithLogging = jest.fn();
|
||||||
|
baseMixin.methods.hideFmgLoadingModal = jest.fn();
|
||||||
const apiResponses = {
|
const apiResponses = {
|
||||||
cmsContent: {
|
cmsContent: {
|
||||||
FunnelSubHeaderWidget: pageHeaderWidgetHeaderText,
|
FunnelSubHeaderWidget: pageHeaderWidgetHeaderText,
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,17 @@ export default {
|
||||||
vm.$refs.backGlassOptions.initializeComponent(
|
vm.$refs.backGlassOptions.initializeComponent(
|
||||||
resultMap.damageOptions.backGlassOptions.availableReplacementOptions
|
resultMap.damageOptions.backGlassOptions.availableReplacementOptions
|
||||||
);
|
);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
if (vm.selectedDamageLocations?.length > 0) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -376,12 +387,12 @@ export default {
|
||||||
payment.insuranceCoverage.coverageStatus !== "" &&
|
payment.insuranceCoverage.coverageStatus !== "" &&
|
||||||
policy.policyNumber !== "";
|
policy.policyNumber !== "";
|
||||||
|
|
||||||
if (vehicleChangedDuringPolicyLookupInHeritage) {
|
const skipVin = await skipVinLookup();
|
||||||
const skipVin = await skipVinLookup();
|
|
||||||
|
|
||||||
|
if (vehicleChangedDuringPolicyLookupInHeritage) {
|
||||||
if (skipVin) {
|
if (skipVin) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -406,6 +417,11 @@ export default {
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
|
} else if (skipVin) {
|
||||||
|
this.$router.navigateWithSaving(
|
||||||
|
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@
|
||||||
import vehicle from "@/layouts/vehicle/vehicle.vue";
|
import vehicle from "@/layouts/vehicle/vehicle.vue";
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
|
import store from "@/store";
|
||||||
import { shallowMount } from "@vue/test-utils";
|
import { shallowMount } from "@vue/test-utils";
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import baseMixin from "../../mixins/base-mixin";
|
import baseMixin from "../../mixins/base-mixin";
|
||||||
|
import { settleAllPromises } from "@/helpers/layout-helper.js";
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
|
@ -18,6 +20,32 @@ jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
fetchCmsContentForPage: jest.fn(),
|
fetchCmsContentForPage: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Mock Store
|
||||||
|
jest.mock("@/store", () => ({
|
||||||
|
commit: jest.fn(),
|
||||||
|
dispatch: jest.fn(),
|
||||||
|
getters: {
|
||||||
|
applicationUser: {
|
||||||
|
experiments: [{ universeName: "ConceptFunnel" }],
|
||||||
|
},
|
||||||
|
isLeadGen: false,
|
||||||
|
vehicle: {
|
||||||
|
carId: "C00000000",
|
||||||
|
image: "test.jpg",
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
vehicle: {
|
||||||
|
year: 2018,
|
||||||
|
make: "Honda",
|
||||||
|
model: "Accord",
|
||||||
|
style: "4 door sedan",
|
||||||
|
carId: "C00000000",
|
||||||
|
image: "test.jpg",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
describe("vehicle.vue", () => {
|
describe("vehicle.vue", () => {
|
||||||
test("arePagePrerequisitesValid should be true ", async () => {
|
test("arePagePrerequisitesValid should be true ", async () => {
|
||||||
//Arrange
|
//Arrange
|
||||||
|
|
@ -58,25 +86,101 @@ describe("vehicle.vue", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks() {
|
describe("vehicle.vue", () => {
|
||||||
const mountOptions = getMountOptions({
|
test("should call forwardButtonAction if isLeadGen is true and displayNoServiceAlert is false", async () => {
|
||||||
router: {
|
// Set up the store with isLeadGen as true
|
||||||
navigate: jest.fn(),
|
store.getters.isLeadGen = true;
|
||||||
navigate: jest.fn(),
|
|
||||||
navigateWithSaving: jest.fn(),
|
|
||||||
navigateWithoutSaving: jest.fn(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set displayNoServiceAlert to false
|
||||||
|
wrapper.setData({ displayNoServiceAlert: false });
|
||||||
|
|
||||||
|
// Mock the getVehicleDetails method
|
||||||
|
wrapper.vm.getVehicleDetails = jest.fn();
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await vehicle.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(nextFunction).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.forwardButtonAction).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
test("should not call forwardButtonAction if isLeadGen is true and displayNoServiceAlert is true", async () => {
|
||||||
|
// Set up the store with isLeadGen as true
|
||||||
|
store.getters.isLeadGen = true;
|
||||||
|
|
||||||
|
// Set up the component
|
||||||
|
const { wrapper } = setupMocks();
|
||||||
|
wrapper.vm.forwardButtonAction = jest.fn();
|
||||||
|
const nextFunction = jest.fn((c) => {
|
||||||
|
c(wrapper.vm);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set displayNoServiceAlert to false
|
||||||
|
wrapper.setData({ displayNoServiceAlert: true });
|
||||||
|
|
||||||
|
// Mock the getVehicleDetails method
|
||||||
|
wrapper.vm.getVehicleDetails = jest.fn();
|
||||||
|
|
||||||
|
// Call the method that contains the if-else logic
|
||||||
|
await vehicle.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle" } },
|
||||||
|
undefined,
|
||||||
|
nextFunction
|
||||||
|
);
|
||||||
|
expect(wrapper.vm.forwardButtonAction).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupMocks() {
|
||||||
|
const groupName = "vehicle";
|
||||||
|
const cmsQuestionText = "Vehicle Year";
|
||||||
|
const cmsAnswers = [{ Name: "Vehicle year" }];
|
||||||
|
const FunnelFooterWidget = { ForwardButtonText: "vehicle button" };
|
||||||
|
|
||||||
|
//Mock CMS Content
|
||||||
|
const cmsContent = {
|
||||||
|
groupName: groupName,
|
||||||
|
QuestionText: cmsQuestionText,
|
||||||
|
Answers: cmsAnswers,
|
||||||
|
FunnelFooterWidget: FunnelFooterWidget,
|
||||||
|
};
|
||||||
//Mock props
|
//Mock props
|
||||||
const mockMixin = {
|
const mockMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
getCmsContent: jest.fn(),
|
getCmsContent: jest.fn(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
const mountOptionsMockData = {
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn(),
|
||||||
|
navigateWithSaving: jest.fn(),
|
||||||
|
navigateWithoutSaving: jest.fn(),
|
||||||
|
},
|
||||||
|
route: {
|
||||||
|
query: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const apiPromise = Promise.resolve({ cmsContent });
|
||||||
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
|
|
||||||
|
const mountOptions = getMountOptions({
|
||||||
|
...mountOptionsMockData,
|
||||||
|
mixins: [baseMixin, mockMixin],
|
||||||
|
});
|
||||||
|
mountOptions["attachTo"] = document.body;
|
||||||
|
|
||||||
mountOptions.mixins = [mockMixin];
|
|
||||||
const wrapper = shallowMount(vehicle, mountOptions);
|
const wrapper = shallowMount(vehicle, mountOptions);
|
||||||
|
wrapper.vm.isDisabled = jest.fn();
|
||||||
return { wrapper };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ export default {
|
||||||
let resultMap = await settleAllPromises(promiseResultMap);
|
let resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next(async (vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.initializeYearComponent(resultMap.yearQuestionInitialData);
|
vm.initializeYearComponent(resultMap.yearQuestionInitialData);
|
||||||
|
|
||||||
|
|
@ -232,6 +232,18 @@ export default {
|
||||||
resultMap.modelQuestionInitialData,
|
resultMap.modelQuestionInitialData,
|
||||||
resultMap.styleQuestionInitialData
|
resultMap.styleQuestionInitialData
|
||||||
);
|
);
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
await vm.getVehicleDetails();
|
||||||
|
if (!vm.displayNoServiceAlert) {
|
||||||
|
vm.forwardButtonAction();
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_IS_LEAD_GEN);
|
||||||
|
baseMixin.methods.hideFmgLoadingModal();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { routerParams } from "@/router/router-constants/router-params";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
import { dynamicStrings } from "@/constants/dynamic-strings";
|
import { dynamicStrings } from "@/constants/dynamic-strings";
|
||||||
import { partTypeStrings } from "../constants/part-type-strings";
|
import { partTypeStrings } from "../constants/part-type-strings";
|
||||||
|
import { showFmgLoadingModal } from "@/helpers/loading-modal-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -192,6 +193,9 @@ export default {
|
||||||
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
const container = document.getElementsByClassName("page-container-grouped-styles")[0];
|
||||||
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
|
||||||
},
|
},
|
||||||
|
hideFmgLoadingModal() {
|
||||||
|
showFmgLoadingModal(false);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
storeActions() {
|
storeActions() {
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,14 @@ const routes = [
|
||||||
);
|
);
|
||||||
const parentAccount = getQuerystringParameter(queryStrings.PARENT_ACCOUNT);
|
const parentAccount = getQuerystringParameter(queryStrings.PARENT_ACCOUNT);
|
||||||
const correlationId = getQuerystringParameter(queryStrings.CORRELATION_ID);
|
const correlationId = getQuerystringParameter(queryStrings.CORRELATION_ID);
|
||||||
|
const vehicleYear = getQuerystringParameter(queryStrings.VEHICLE_YEAR);
|
||||||
|
const vehicleMake = getQuerystringParameter(queryStrings.VEHICLE_MAKE);
|
||||||
|
const vehicleModel = getQuerystringParameter(queryStrings.VEHICLE_MODEL);
|
||||||
|
const vehicleStyle = getQuerystringParameter(queryStrings.VEHICLE_STYLE);
|
||||||
|
const vehicleDamage = getQuerystringParameter(queryStrings.VEHICLE_DAMAGE);
|
||||||
|
const serviceZip = getQuerystringParameter(queryStrings.SERVICE_ZIP);
|
||||||
|
const email = getQuerystringParameter(queryStrings.EMAIL);
|
||||||
|
const isInsurance = getQuerystringParameter(queryStrings.IS_INSURANCE);
|
||||||
if (referralNumber) {
|
if (referralNumber) {
|
||||||
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber);
|
store.commit(storeMutations.UPDATE_REFERRAL_NUMBER, referralNumber);
|
||||||
store.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccount);
|
store.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccount);
|
||||||
|
|
@ -93,6 +101,50 @@ const routes = [
|
||||||
);
|
);
|
||||||
updateOrCreateFunnelCookie();
|
updateOrCreateFunnelCookie();
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
vehicleYear &&
|
||||||
|
vehicleMake &&
|
||||||
|
vehicleModel &&
|
||||||
|
vehicleStyle &&
|
||||||
|
vehicleDamage &&
|
||||||
|
serviceZip &&
|
||||||
|
email &&
|
||||||
|
isInsurance
|
||||||
|
) {
|
||||||
|
if (!store.getters.applicationUser.triggeredSiteEntry) {
|
||||||
|
store.commit(storeMutations.UPDATE_YEAR, vehicleYear);
|
||||||
|
store.commit(storeMutations.UPDATE_MAKE, vehicleMake);
|
||||||
|
store.commit(storeMutations.UPDATE_MODEL, vehicleModel);
|
||||||
|
store.commit(storeMutations.UPDATE_STYLE, vehicleStyle);
|
||||||
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, true);
|
||||||
|
if (vehicleDamage == "windshieldReplace") {
|
||||||
|
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||||
|
store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null);
|
||||||
|
const glassToReplace = [
|
||||||
|
{ glassLocation: "Windshield", glassName: "Single" },
|
||||||
|
];
|
||||||
|
store.commit(
|
||||||
|
storeMutations.UPDATE_GLASS_TO_REPLACE,
|
||||||
|
glassToReplace
|
||||||
|
);
|
||||||
|
} else if (vehicleDamage == "windshieldRepair") {
|
||||||
|
store.commit(storeMutations.UPDATE_IS_REPAIR, true);
|
||||||
|
store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, 1);
|
||||||
|
}
|
||||||
|
const serviceZipInfo = {
|
||||||
|
state: null,
|
||||||
|
zipCode: serviceZip,
|
||||||
|
zipCodeCtu: null,
|
||||||
|
};
|
||||||
|
store.commit(storeMutations.UPDATE_SERVICE_ZIP, serviceZipInfo);
|
||||||
|
store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email);
|
||||||
|
if (isInsurance == "true") {
|
||||||
|
store.commit(storeMutations.UPDATE_IS_INSURANCE, true);
|
||||||
|
} else {
|
||||||
|
store.commit(storeMutations.UPDATE_IS_INSURANCE, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const loadSessionResponse = await loadSessionIfPresent(
|
const loadSessionResponse = await loadSessionIfPresent(
|
||||||
to.query.isInsurance != null
|
to.query.isInsurance != null
|
||||||
|
|
@ -234,6 +286,22 @@ router.beforeEach(async (to, from, next) => {
|
||||||
const notToPIAReturn = toQueryPage != fmgPageValues.PAYMENT_PIA_RETURN;
|
const notToPIAReturn = toQueryPage != fmgPageValues.PAYMENT_PIA_RETURN;
|
||||||
const isInIframe = window !== window.top;
|
const isInIframe = window !== window.top;
|
||||||
|
|
||||||
|
if (store.getters.isLeadGen) {
|
||||||
|
// Check if alert event is on the bus
|
||||||
|
const alertEvent = eventBus.readEventFromBus(
|
||||||
|
globalEvents.Categories.GLOBAL_ALERT,
|
||||||
|
globalEvents.SubCategories.PAGE_NOT_FOUND
|
||||||
|
);
|
||||||
|
//Uknown alerts most likely were added by a failed api call in global-methods
|
||||||
|
const unknownAlertEvent = eventBus.readEventFromBus(
|
||||||
|
globalEvents.Categories.GLOBAL_ALERT,
|
||||||
|
globalEvents.SubCategories.UNKNOWN_ERROR
|
||||||
|
);
|
||||||
|
// If alert event is on the bus, then display the alert
|
||||||
|
if (alertEvent !== undefined || unknownAlertEvent !== undefined) {
|
||||||
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// fromPaymentToConfirmation workaround for navigating from an iframe but
|
// fromPaymentToConfirmation workaround for navigating from an iframe but
|
||||||
// isInIframe evaluates to false for some reason when navigating from payment to confirmation
|
// isInIframe evaluates to false for some reason when navigating from payment to confirmation
|
||||||
const fromPaymentToConfirmation =
|
const fromPaymentToConfirmation =
|
||||||
|
|
@ -265,8 +333,9 @@ router.afterEach(async (to, from) => {
|
||||||
await saveSession({ pageNameToLog: to.query.fmgPage });
|
await saveSession({ pageNameToLog: to.query.fmgPage });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!store.getters.isLeadGen) {
|
||||||
showFmgLoadingModal(false);
|
showFmgLoadingModal(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Push page view to GA
|
// Push page view to GA
|
||||||
analyticsMixin.methods.pushPageViewToGA();
|
analyticsMixin.methods.pushPageViewToGA();
|
||||||
|
|
@ -487,7 +556,7 @@ async function DisplayPageError() {
|
||||||
type: globalEventTypes.Danger,
|
type: globalEventTypes.Danger,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
store.commit(storeMutations.UPDATE_IS_LEAD_GEN, false);
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
baseMixin.methods.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
const pageError = getQuerystringParameter(queryStrings.PAGE_ERROR);
|
const pageError = getQuerystringParameter(queryStrings.PAGE_ERROR);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ const fmgPageValues = {
|
||||||
CAPABILITY_QUESTIONS: "capability-questions",
|
CAPABILITY_QUESTIONS: "capability-questions",
|
||||||
LICENSE_PLATE_LOOKUP: "license-plate-lookup",
|
LICENSE_PLATE_LOOKUP: "license-plate-lookup",
|
||||||
ESTIMATE: "estimate",
|
ESTIMATE: "estimate",
|
||||||
|
SERVICE_ZIP: "service-zip",
|
||||||
ADDRESS_VEHICLES: "address-vehicles",
|
ADDRESS_VEHICLES: "address-vehicles",
|
||||||
QUOTE: "quote",
|
QUOTE: "quote",
|
||||||
INSURANCE_COMPANY: "insurance-company",
|
INSURANCE_COMPANY: "insurance-company",
|
||||||
|
|
|
||||||
|
|
@ -15,17 +15,20 @@ const navigationScenarios = {
|
||||||
|
|
||||||
// Vin selection
|
// Vin selection
|
||||||
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
|
CLICKED_BACK_WITH_VIN: "CLICKED_BACK_WITH_VIN",
|
||||||
|
CLICKED_BACK_WITH_SKIP_VIN: "CLICKED_BACK_WITH_SKIP_VIN",
|
||||||
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
|
CLICKED_FORWARD_WITH_VIN: "CLICKED_FORWARD_WITH_VIN",
|
||||||
CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE:
|
CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE:
|
||||||
"CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE",
|
"CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE",
|
||||||
CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE:
|
CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE:
|
||||||
"CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE",
|
"CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE",
|
||||||
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
|
CLICKED_FORWARD_WITHOUT_VIN: "CLICKED_FORWARD_WITHOUT_VIN",
|
||||||
|
CLICKED_FORWARD_WITH_SKIP_VIN: "CLICKED_FORWARD_WITH_SKIP_VIN",
|
||||||
CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES: "CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES",
|
CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES: "CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES",
|
||||||
SELECTED_VIN_WITH_MISMATCHED_GLASS: "SELECTED_VIN_WITH_MISMATCHED_GLASS",
|
SELECTED_VIN_WITH_MISMATCHED_GLASS: "SELECTED_VIN_WITH_MISMATCHED_GLASS",
|
||||||
SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN",
|
SELECTED_MANUAL_VIN: "SELECTED_MANUAL_VIN",
|
||||||
SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
|
SELECTED_LICENSE_PLATE: "SELECTED_LICENSE_PLATE",
|
||||||
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
|
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
|
||||||
|
SELECTED_NO_VIN: "SELECTED_NO_VIN",
|
||||||
CLICKED_FORWARD_WITH_NO_QUESTIONS: "CLICKED_FORWARD_WITH_NO_QUESTIONS",
|
CLICKED_FORWARD_WITH_NO_QUESTIONS: "CLICKED_FORWARD_WITH_NO_QUESTIONS",
|
||||||
CLICKED_VIN_RETRY: "CLICKED_VIN_RETRY",
|
CLICKED_VIN_RETRY: "CLICKED_VIN_RETRY",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,14 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
||||||
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario:
|
scenario:
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
|
navigationScenarios.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario:
|
scenario:
|
||||||
|
|
@ -216,6 +220,23 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.SELECTED_HOME_ADDRESS,
|
scenario: navigationScenarios.SELECTED_HOME_ADDRESS,
|
||||||
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
|
destinationFmgPageValue: fmgPageValues.ADDRESS_LOOKUP,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.SELECTED_NO_VIN,
|
||||||
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
|
maps: [
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_SKIP_VIN,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
|
|
@ -251,7 +272,7 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
|
|
@ -284,7 +305,7 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||||
|
|
@ -309,7 +330,7 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
|
|
@ -338,7 +359,7 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
|
|
@ -367,7 +388,7 @@ const routingTable = function (store) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
destinationFmgPageValue: fmgPageValues.SERVICE_ZIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@ const getDefaultState = () => {
|
||||||
customerPortalLoginToken: null,
|
customerPortalLoginToken: null,
|
||||||
lockToken: null,
|
lockToken: null,
|
||||||
settledTenderAmount: 0,
|
settledTenderAmount: 0,
|
||||||
|
isLeadGen: false,
|
||||||
},
|
},
|
||||||
applicationUser: {
|
applicationUser: {
|
||||||
eventBus: [],
|
eventBus: [],
|
||||||
|
|
@ -294,6 +295,9 @@ export const mutations = {
|
||||||
updateSettledTenderAmount(state, settledTenderAmount) {
|
updateSettledTenderAmount(state, settledTenderAmount) {
|
||||||
state.order.settledTenderAmount = settledTenderAmount;
|
state.order.settledTenderAmount = settledTenderAmount;
|
||||||
},
|
},
|
||||||
|
updateIsLeadGen(state, isLeadGen) {
|
||||||
|
state.order.isLeadGen = isLeadGen;
|
||||||
|
},
|
||||||
updateCCToken(state, ccToken) {
|
updateCCToken(state, ccToken) {
|
||||||
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
state.order.payment.ccToken.subscriptionId = ccToken.subscriptionId;
|
||||||
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
state.order.payment.ccToken.expMonth = ccToken.expMonth;
|
||||||
|
|
@ -674,6 +678,7 @@ export const getters = {
|
||||||
isOvernightDropOffAppointment: (state) => {
|
isOvernightDropOffAppointment: (state) => {
|
||||||
return state.order.schedule.routeCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF);
|
return state.order.schedule.routeCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF);
|
||||||
},
|
},
|
||||||
|
isLeadGen: (state) => state.order.isLeadGen,
|
||||||
isRecalibrationOnOrder: (state) => {
|
isRecalibrationOnOrder: (state) => {
|
||||||
return getHasRecalibrationPart(state);
|
return getHasRecalibrationPart(state);
|
||||||
},
|
},
|
||||||
|
|
@ -1927,10 +1932,13 @@ export const actions = {
|
||||||
context.state.order.vehicle.year != year ||
|
context.state.order.vehicle.year != year ||
|
||||||
context.state.order.vehicle.make != make ||
|
context.state.order.vehicle.make != make ||
|
||||||
context.state.order.vehicle.model != model ||
|
context.state.order.vehicle.model != model ||
|
||||||
context.state.order.vehicle.style != style
|
context.state.order.vehicle.style != style ||
|
||||||
|
context.state.order.isLeadGen
|
||||||
) {
|
) {
|
||||||
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
if (!context.state.order.isLeadGen) {
|
||||||
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
|
||||||
|
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
|
||||||
|
}
|
||||||
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
|
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
|
||||||
context.commit(storeMutations.UPDATE_YEAR, year);
|
context.commit(storeMutations.UPDATE_YEAR, year);
|
||||||
context.commit(storeMutations.UPDATE_MAKE, make);
|
context.commit(storeMutations.UPDATE_MAKE, make);
|
||||||
|
|
@ -2701,6 +2709,9 @@ export const actions = {
|
||||||
// clear from local storage
|
// clear from local storage
|
||||||
window.sessionStorage.removeItem("submittedOrder");
|
window.sessionStorage.removeItem("submittedOrder");
|
||||||
},
|
},
|
||||||
|
resetIsLeadGen(context) {
|
||||||
|
context.commit(storeMutations.UPDATE_IS_LEAD_GEN, false);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,19 @@ body {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Quote page desktop
|
||||||
|
&.quote {
|
||||||
|
.col-md-6,
|
||||||
|
.col-lg-4 {
|
||||||
|
max-width: 1200px;
|
||||||
|
}
|
||||||
|
.col-md-6.col-lg-4 {
|
||||||
|
@include media-breakpoint-up(lg) {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 910px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//END set max-width on columns
|
//END set max-width on columns
|
||||||
}
|
}
|
||||||
.pointer {
|
.pointer {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue