From 4c9790b9388ea44d28ca9610093e34999d1ad7c0 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Tue, 12 Aug 2025 12:19:49 +0000 Subject: [PATCH] Merged in feat/SW-2643-aa-tracking-phone-number-email- (pull request #2617) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: SW-2643 Tracking added mobile and email hash in booking cofirmation * feat: SW-2643 Tracking added mobile and email hash in booking cofirmation Approved-by: Matilda Landström --- .../BookingConfirmation/Tracking/tracking.ts | 7 +++++++ apps/scandic-web/types/components/tracking.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts index 3edc1c443..3ec0cb4a6 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts @@ -1,3 +1,4 @@ +import { createHash } from "crypto" import { differenceInCalendarDays, format, isWeekend } from "date-fns" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" @@ -169,6 +170,8 @@ export function getTracking( : "no" : "na", guaranteedProduct: isGuaranteedFlexBooking ? "room" : "na", + emailId: getSHAHash(booking.guest.email), + mobileNumber: getSHAHash(booking.guest.phoneNumber), } const paymentInfo: TrackingSDKPaymentInfo = { @@ -208,3 +211,7 @@ function constructRateCodeName(room: Room) { .filter(Boolean) .join(" - ") } + +function getSHAHash(key: string) { + return createHash("sha256").update(key).digest("hex") +} diff --git a/apps/scandic-web/types/components/tracking.ts b/apps/scandic-web/types/components/tracking.ts index 2625acd7a..5cb32c182 100644 --- a/apps/scandic-web/types/components/tracking.ts +++ b/apps/scandic-web/types/components/tracking.ts @@ -95,6 +95,8 @@ export type TrackingSDKHotelInfo = { totalPrice?: number | string lateArrivalGuarantee?: string guaranteedProduct?: string + emailId?: string // Encrypted hash value on booking confirmation page + mobileNumber?: string // Encrypted hash value on booking confirmation page } export type Ancillary = {