From 24e7ab4b719f01db0a2f320e80af3a0f1cbacbfb Mon Sep 17 00:00:00 2001 From: Bianca Widstam Date: Fri, 16 May 2025 11:42:56 +0000 Subject: [PATCH] Merged in fix/SW-2764-remove-ancillaries-breakfast-selection (pull request #2122) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(SW-2764): Tracking - remove ancillaries array if no breakfast selected * fix(SW-2764): remove ancillaries array if no breakfast selected Approved-by: Tobias Johansson Approved-by: Joakim Jäderberg --- apps/scandic-web/utils/tracking/booking.ts | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/scandic-web/utils/tracking/booking.ts b/apps/scandic-web/utils/tracking/booking.ts index 57510a690..f649bc0f6 100644 --- a/apps/scandic-web/utils/tracking/booking.ts +++ b/apps/scandic-web/utils/tracking/booking.ts @@ -47,18 +47,20 @@ export function trackBreakfastSelection({ selection: { name: "breakfast options selection click", }, - ancillaries: [ - { - hotelId: hotelId, - productCategory: "", - productId: breakfastPackage.code, - productUnits: units, - productPrice: units > 0 ? breakfastPackage.localPrice.price * units : 0, - productPoints: 0, - productType: "food", - productName: breakfastPackage.packageType, - }, - ], + ...(units > 0 && { + ancillaries: [ + { + hotelId, + productCategory: "", + productId: breakfastPackage.code, + productUnits: units, + productPrice: breakfastPackage.localPrice.price * units, + productPoints: 0, + productType: "food", + productName: breakfastPackage.packageType, + }, + ], + }), pageInfo: { pageName: "hotelreservation|breakfast", pageType: "bookingbreakfastpage",