Merge pull request #2299 from Safelite/release/2025.02.13

Release/2025.02.13
This commit is contained in:
CarlNation 2025-02-12 13:12:24 -05:00 committed by GitHub
commit 182255821c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 127 additions and 6 deletions

View file

@ -16,6 +16,13 @@
v-model="parentAccountNumber" v-model="parentAccountNumber"
:originalList="originalList" /> :originalList="originalList" />
</div> </div>
<textLink
id="payOnMyOwnBackButton"
useLoadingModal
linkType="text"
:text="payWithCashButtonCopy"
href="javascript:void(0)"
@click-event="backButtonAction(foreceCashSelectionOnQuote = true)" />
<navbar <navbar
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
@ -36,6 +43,7 @@ import navbar from "@/fmg-components/nav-bar/nav-bar";
import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header"; import funnelSubHeader from "@/fmg-components/funnel-sub-header/funnel-sub-header";
import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue"; import loadingModal from "@/fmg-components/loading-modal/loading-modal.vue";
import insuranceCompanyQuestion from "@/layouts/insurance-company/insurance-company-question"; import insuranceCompanyQuestion from "@/layouts/insurance-company/insurance-company-question";
import textLink from "../../ux-components/text-link/text-link.vue";
// Supporting files // Supporting files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
@ -92,6 +100,9 @@ export default {
isParentAccountNumber() { isParentAccountNumber() {
return !!this.parentAccountNumber; return !!this.parentAccountNumber;
}, },
payWithCashButtonCopy() {
return this.getCmsContent("PayWithCashWidget", "Text");
}
}, },
methods: { methods: {
isCashParentAccountNumber() { isCashParentAccountNumber() {
@ -109,8 +120,13 @@ export default {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return store.getters.order.payment.isInsurance === true; return store.getters.order.payment.isInsurance === true;
}, },
backButtonAction() { backButtonAction(forceCashSelectionOnQuote) {
// Go back to Quote page // Go back to Quote page
if (forceCashSelectionOnQuote) {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route, {"isCashSelected": true});
return;
}
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
async forwardButtonAction() { async forwardButtonAction() {
@ -157,6 +173,7 @@ export default {
Form, Form,
loadingModal, loadingModal,
insuranceCompanyQuestion, insuranceCompanyQuestion,
textLink,
}, },
}; };
</script> </script>

View file

@ -78,6 +78,20 @@ export default {
); );
} }
if (store.getters.externalParameterCustomer?.phoneNumber) {
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PHONE_NUMBER,
store.getters.externalParameterCustomer.phoneNumber,
false
);
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_SMS_OPT_IN,
true,
false
);
}
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -79,6 +79,21 @@ export default {
false false
); );
} }
if (store.getters.externalParameterCustomer?.phoneNumber) {
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PHONE_NUMBER,
store.getters.externalParameterCustomer.phoneNumber,
false
);
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_SMS_OPT_IN,
true,
false
);
}
baseMixin.methods.ResetExternalParamsAndHideModal(); baseMixin.methods.ResetExternalParamsAndHideModal();
} }
}); });

View file

@ -577,6 +577,56 @@ describe("quote.vue", () => {
//Assert //Assert
expect(wrapper.vm.isInsuranceSelected).toBe(false); expect(wrapper.vm.isInsuranceSelected).toBe(false);
}); });
test("should default to cash if isCashSelected is true, despite all other checks pointing to insurance selection", async () => {
// Also needs no query parameter or previous selection in store to be present
//Arrange
store.getters = {
lineItems: {
glassParts: ["item", "item2"],
},
applicationUser: {
experiments: [],
},
order: {
lineItems: {
glassParts: ["item", "item2"],
},
payment: {
isInsurance: true,
},
customer: {
emailAddress: "test@test.com",
},
serviceLocation: {
state: null,
},
},
vehicle: {
cardId: "123",
},
experimentSettings: {
settingName: "SERVICE_PACKAGE_DISCOUNT",
},
};
mockTierOnePrice = 505;
const { wrapper } = setupMocks({});
//Act
await quote.beforeRouteEnter.call(
wrapper.vm,
{ query: { fmgPage: "quote",
isInsuranceSelected: true,
isCashSelected: true,
} },
undefined,
(c) => c(wrapper.vm)
);
//Assert
expect(wrapper.vm.isInsuranceSelected).toBe(false);
});
test("should default to insurance if total economy package price is over $500", async () => { test("should default to insurance if total economy package price is over $500", async () => {
// Also needs no query parameter or previous selection in store to be present // Also needs no query parameter or previous selection in store to be present
//Arrange //Arrange

View file

@ -328,6 +328,10 @@ export default {
} }
const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => { const getIsInsuranceSelectedValue = (availableLineItems, insuranceThreshold) => {
// query param checked here is set on insurance-selection "Pay on my own" link click
if (to.query?.isCashSelected || to.query?.iscashselected) {
return false;
}
const serviceLocationState = store.getters.order.serviceLocation.state; const serviceLocationState = store.getters.order.serviceLocation.state;
// usually true when returning from heritage but can be false when returning from heritage on a save quote // usually true when returning from heritage but can be false when returning from heritage on a save quote

View file

@ -202,11 +202,18 @@ export default {
async forwardButtonAction() { async forwardButtonAction() {
const zipCodeData = await this.getZipCodeData(this.serviceZipCode); const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) { // if no value due to field being optional, blank both phone and email address
const phone = this.emailOrSms.replace(/[()]/g, ""); if (!this.emailOrSms) {
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false); await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, "", false);
} else { await this.dispatchStoreAction(storeActions.SAVE_EMAIL, "", false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false); }
else {
if (vinPagesMixin.methods.isPhoneNumber(this.emailOrSms)) {
const phone = this.emailOrSms.replace(/[()]/g, "");
await this.dispatchStoreAction(storeActions.SAVE_PHONE_NUMBER, phone, false);
} else {
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailOrSms, false);
}
} }
await this.dispatchStoreAction( await this.dispatchStoreAction(

View file

@ -152,6 +152,20 @@ export default {
if (isValid) { if (isValid) {
vm.forwardButtonAction(); vm.forwardButtonAction();
} else { } else {
if (store.getters.externalParameterCustomer?.phoneNumber) {
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PHONE_NUMBER,
store.getters.externalParameterCustomer.phoneNumber,
false
);
await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_SMS_OPT_IN,
true,
false
);
}
if (store.getters.externalParameterServiceZip.zipCode) { if (store.getters.externalParameterServiceZip.zipCode) {
await baseMixin.methods.dispatchStoreAction( await baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_SERVICE_ZIP_CODE_INFO, storeActions.SAVE_SERVICE_ZIP_CODE_INFO,