diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js
index cf037a8b..9462cdc6 100644
--- a/src/iss-components/cart-dropdown/cart-dropdown.spec.js
+++ b/src/iss-components/cart-dropdown/cart-dropdown.spec.js
@@ -1125,7 +1125,7 @@ describe('cart-dropdown component', () => {
// Assert
expect(result).toContainEqual(expect.objectContaining({
- isRecycle: true
+ partType: partTypeStrings.REPLACE_FEE
}));
});
test('when mobileFee, includes mobile fee', () => {
@@ -1355,7 +1355,7 @@ describe('cart-dropdown component', () => {
// Assert
expect(result.length).toBe(3);
expect(result).toContainEqual(expect.objectContaining({
- isRecycle: true
+ partType: partTypeStrings.REPLACE_FEE
}));
expect(result).toContainEqual(expect.objectContaining({
partType: partTypeStrings.MOBILE_FEE
diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue
index 661c2b81..e37e5dce 100644
--- a/src/iss-components/cart-dropdown/cart-dropdown.vue
+++ b/src/iss-components/cart-dropdown/cart-dropdown.vue
@@ -63,7 +63,7 @@
linkType="text"
text="Remove"
href="javascript:void(0)"
- @clickEvent="removeItem(item.partType, true)">
+ @clickEvent="removeVap(item.partType)">
{{ item?.name ?? '' }}
@@ -81,7 +81,7 @@
class="px-5 py-1 non-packaged-cart-item">
{{ getDisplayed(item?.subTotal ?? 0, false) }}
+ @clickEvent="removeVap(item.partType)">
{{ item?.name ?? '' }}
@@ -368,10 +368,7 @@ export default {
? this.getCartItem(
this.getCmsContent(this.widget.recycleFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
[recycleFeeLineItem],
- false,
- partTypeStrings.REPLACE_FEE, // NOTE this is not a mistake
- false,
- true
+ partTypeStrings.REPLACE_FEE // NOTE this is not a mistake
)
: null;
},
@@ -381,10 +378,7 @@ export default {
? this.getCartItem(
this.getCmsContent(this.widget.mobileFee, widgetFields.TEXT_BLOCK_WIDGET.TEXT),
[mobileFeeLineItem],
- false,
- partTypeStrings.MOBILE_FEE,
- false,
- false
+ partTypeStrings.MOBILE_FEE
)
: null;
}
@@ -404,7 +398,7 @@ export default {
? VERIFYING_COVERAGE
: formatAmountInDollars(amount);
},
- getCartItem(label, lineItems, isRemovable, partType, isVap, isRecycle) {
+ getCartItem(label, lineItems, partType) {
let cartItem = null;
if (lineItems && lineItems.length > 0) {
@@ -415,10 +409,7 @@ export default {
salesTax: lineItems?.reduce(
(accumulator, lineItem) => accumulator + lineItem.salesTax,
0
- ) ?? 0,
- isRemovable,
- isVap,
- isRecycle
+ ) ?? 0
};
}
@@ -428,15 +419,11 @@ export default {
const label = this.getCmsContentForVapsType(partType);
const lineItems = useMainStore().lineItems.vaps
?.filter((vapsLineItem) => vapsLineItem.partType === partType) ?? [];
- return this.getCartItem(label, lineItems, true, partType, true, false);
+ return this.getCartItem(label, lineItems, partType);
},
- removeItem(partType, isVap) {
- if (isVap) {
- const newVaps = useMainStore().lineItems.vaps?.filter((vap) => vap?.partType !== partType) ?? [];
- console.log(`new vaps: ${JSON.stringify(newVaps)}`);
- useMainStore().updateVaps(newVaps);
- }
- // NOTE Currently only vaps can be removed
+ removeVap(partType) {
+ const newVaps = useMainStore().lineItems.vaps?.filter((vap) => vap?.partType !== partType) ?? [];
+ useMainStore().updateVaps(newVaps);
},
getCmsContentForVapsType(vapsType) {
const vapsItemDescriptions = this.getCmsContent(
@@ -451,6 +438,17 @@ export default {
const vapsTypeDescription = vapsItemDescriptions?.find((entry) => entry?.Name === vapsType);
return vapsTypeDescription?.Text ?? '';
},
+ isVap(partType) {
+ const vapPartTypes = [
+ partTypeStrings.FRONT_WIPER,
+ partTypeStrings.REAR_WIPER,
+ partTypeStrings.RAIN_DEFENSE
+ ];
+ return vapPartTypes.includes(partType);
+ },
+ isRecycle(partType) {
+ return partTypeStrings.REPLACE_FEE === partType;
+ },
formatAmountInDollars
}
};