Merge pull request #2390 from Safelite/feature/clean-up-foster-love

Clean up of Foster Love cart logic
This commit is contained in:
scottkiener-at-safelite 2025-04-02 10:25:44 -04:00 committed by GitHub
commit d11cc256e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 12 deletions

View file

@ -401,11 +401,15 @@ export default {
if (!this.lineItems || this.lineItems.length < 1) {
return [];
}
let supportingItemsToAdd = [];
if (this.lineItems.supportingItems) {
supportingItemsToAdd = this.lineItems.supportingItems.filter(
(item) => item.partType !== partTypeStrings.DONATION
);
}
return [
...(this.lineItems.glassParts ?? []),
...(this.lineItems.supportingItems.filter(
(item) => item.partType !== partTypeStrings.DONATION
) ?? []),
...supportingItemsToAdd,
...(this.availableVaps ?? []),
];
},
@ -1074,11 +1078,7 @@ export default {
const donationLineItem = this.lineItems.supportingItems.find(
(item) => item.partType === partTypeStrings.DONATION
);
if (donationLineItem?.sellingPrice !== 0) {
return true;
} else {
return false;
}
return !!donationLineItem;
},
donationCartItemName() {
return this.getCmsContent("DonationCartTextWidget", "Text");
@ -1092,7 +1092,7 @@ export default {
(item) => item.partType === partTypeStrings.DONATION
);
if (donationLineItem?.sellingPrice > 0) {
if (donationLineItem) {
return {
name: this.donationCartItemName,
category: cartItemCategories.SUPPORTING_ITEMS,

View file

@ -63,9 +63,7 @@
:isExpandedOnLoad="false"
:isItac="isItac"
:isNoComp="isNoComp"
:isMSRFeeApplicable="isMSRFeeApplicable"
:donationAmount="donationAmount"
@update-donation-amount="updateDonationAmount" />
:isMSRFeeApplicable="isMSRFeeApplicable" />
<div class="mt-3" v-if="DisplayFosterLove">
<donationBlock