Merge pull request #1973 from Safelite/feature/CSR-2179-ajc

Feature/CSR-2179-ajc
This commit is contained in:
AdamCaouetteSafelite 2024-09-16 09:23:57 -04:00 committed by GitHub
commit cb4d85b48d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 28 additions and 52 deletions

View file

@ -305,9 +305,9 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) return;
const lineItemsCopy = deepClone(this.lineItems);
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems ? baseMixin.methods.filterOutRecalibration(
lineItemsCopy?.supportingItems
) : [];
lineItemsCopy.supportingItems = lineItemsCopy.supportingItems
? baseMixin.methods.filterOutRecalibration(lineItemsCopy?.supportingItems)
: [];
return lineItemsCopy;
},
showCoverageAsPending() {
@ -438,13 +438,15 @@ export default {
packagePrice() {
let packagePrice = 0;
if (!this.isInsurance && this.shouldHideRecalibration) { // Update packagePrice if Cash only && is part of RemoveRecal experiment
if (!this.isInsurance && this.shouldHideRecalibration) {
// Update packagePrice if Cash only && is part of RemoveRecal experiment
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(
baseMixin.methods.filterOutRecalibration(this.availableLineItems) // Strip out recal before filtering out fees
)
);
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) { // Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
// Update packagePrice if is verified insurance OR if Cash && not part of RemoveRecal experiment
packagePrice = baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.availableLineItems)
);
@ -1001,7 +1003,7 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) return;
return this.isInsurance || !this.shouldHideRecalibration
? baseMixin.methods.getSubTotal(this.lineItems) // calculate with recal (if on order)
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculated without recal
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal); // calculate without recal
},
salesTax() {
if (!this.lineItems || this.lineItems.length < 1) return;

View file

@ -170,9 +170,7 @@ export default {
},
computed: {
shouldHideRecalibration() {
return this.getSettingValue(
experimentSettings.RECAL_PRICE_REMOVE
);
return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE);
},
ShowCart() {
if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) {

View file

@ -55,7 +55,9 @@
class="service-questions" />
<textBlock cmsWidgetName="CallOrTextWidget" justifyText="left" />
<hr class="my-5" />
<div class="d-flex flex-row checkbox-group" v-if="isRecalibrationOnOrder && shouldHideRecalibration">
<div
class="d-flex flex-row checkbox-group"
v-if="isRecalibrationOnOrder && shouldHideRecalibration">
<checkboxQuestion
cmsWidgetName="RecalConfirmWidget"
class="mb-5"
@ -592,9 +594,7 @@ export default {
);
},
shouldHideRecalibration() {
return this.getSettingValue(
experimentSettings.RECAL_PRICE_REMOVE
);
return this.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE);
},
showApplePay() {
return baseMixin.methods.showApplePay();

View file

@ -750,7 +750,10 @@ function setupMocks({ customMountOptions }) {
baseMixin.methods.ResetExternalParamsAndHideModal = jest.fn();
baseMixin.methods.isFormValid = jest.fn().mockReturnValue(true);
mountOptions.global.mocks["$store"] = store;
store.getters.experimentSettings = "test value";
mountOptions["attachTo"] = document.body;
const wrapper = shallowMount(quote, mountOptions);
wrapper.vm.setCmsContent = jest.fn();
return { wrapper };

View file

@ -31,6 +31,8 @@
groupName="ServicePackageQuestion"
:availableLineItems="availableLineItems"
:isInsuranceSelected="isInsuranceSelected"
:isRecalibrationOnOrder="isRecalibrationOnOrder"
:shouldHideRecalibration="shouldHideRecalibration"
@vapsItemsSelected="vapsItemsSelectedAction"
@servicePackageDiscountSelected="servicePackageDiscountSelectedAction"
:servicePackage="servicePackage"
@ -138,9 +140,6 @@ export default {
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const experimentForLogging = store.getters.applicationUser.experiments.find(
(e) => e.universeName === experimentUniverses.RECAL_PRICE_REMOVAL
);
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_WIPERS,
{
@ -208,33 +207,6 @@ export default {
...servicePackageDiscountPart,
];
// If the recal experiment is found then log the experiment exposure.
const isRecalibrationOnOrder = containsLineItemWithPartType(
partTypeStrings.RECALIBRATION,
availableLineItems
);
const canSafeliteRecalibrate = nullSafeGlassParts.some((glassPart) => {
return glassPart.partType === "WINDSHIELD" && glassPart.canSafeliteRecalibrate;
});
if (
experimentForLogging !== undefined &&
isRecalibrationOnOrder &&
canSafeliteRecalibrate
) {
// Log experiment exposure
baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.LOG_EXPERIMENT_EXPOSURE,
{
userId: getUserIdValue(),
sessionKey: getSessionKeyValue(),
pageName: to.query.fmgPage,
experiment: experimentForLogging,
},
"quote",
false
);
}
// When calling pricing from the quote page, always use the cash parent account
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
@ -366,10 +338,13 @@ export default {
return recalSettingValue;
},
showAfterpayBanner() {
return !this.isInsuranceSelected && (!this.isRecalibrationOnOrder || !this.shouldHideRecalibration)
return (
!this.isInsuranceSelected &&
(!this.isRecalibrationOnOrder || !this.shouldHideRecalibration)
);
},
showRecalDisclaimer() {
return this.isRecalibrationOnOrder && this.shouldHideRecalibration
return this.isRecalibrationOnOrder && this.shouldHideRecalibration;
},
},
methods: {

View file

@ -475,6 +475,7 @@ describe("service-package-question.vue, matching business rules for package disp
mockProps.availableLineItems.push(recalLineItem);
mockProps.availableLineItems.push(driverFrontWiperLineItem);
mockProps.availableLineItems.push(passengerFrontWiperLineItem);
mockProps.isRecalibrationOnOrder = true;
Object.assign(processedCmsContent, mockProcessedCmsContent[packageNameKey]);
const wrapper = setupMocks({
mountOptionsMockData: {

View file

@ -49,6 +49,8 @@ export default {
availableLineItems: null,
activePromos: null,
servicePackage: null,
isRecalibrationOnOrder: Boolean,
shouldHideRecalibration: Boolean,
},
data() {
return {
@ -141,12 +143,6 @@ export default {
}));
return modifiedAnswers;
},
isRecalibrationOnOrder() {
return containsLineItemWithPartType(
partTypeStrings.RECALIBRATION,
this.nullSafeAvailableLineItems
);
},
isServicePackageDiscountOnOrder() {
return containsLineItemWithPartType(
partTypeStrings.SERVICE_PACKAGE_DISCOUNT,
@ -242,7 +238,8 @@ export default {
},
getPackagePrice(packageName, { discountedPrice = false, servicePackageDiscount = false }) {
var lineItemsToPrice = [...this.nullSafeAvailableLineItems];
if (this.isRecalibrationOnOrder) {
if (this.isRecalibrationOnOrder && this.shouldHideRecalibration) {
lineItemsToPrice = lineItemsToPrice.filter((item) => {
return item.partType != partTypeStrings.RECALIBRATION;
});