Update containsRecalPart to accept both lineitems formats
This commit is contained in:
parent
4075d685f4
commit
51fb83932d
1 changed files with 14 additions and 1 deletions
|
|
@ -19,7 +19,20 @@ export function containsRecalParts(lineItems) {
|
|||
if (!lineItems) {
|
||||
return false;
|
||||
}
|
||||
return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
|
||||
if (Array.isArray(lineItems)) {
|
||||
return lineItems.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
} else {
|
||||
// complex object form -- flatten and re-call.
|
||||
const flattened = [
|
||||
...(lineItems.glassParts ?? []),
|
||||
...(lineItems.supportingItems ?? []),
|
||||
...(lineItems.vaps ?? []),
|
||||
...(lineItems.promos ?? []),
|
||||
];
|
||||
|
||||
return flattened.some((li) => isRecalPartOrHasChildRecalPart(li));
|
||||
}
|
||||
}
|
||||
|
||||
export function getItemsWithoutRecalParts(lineItems) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue