From 7dee6d5083d0e2ee96333e371196688a33791948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Thu, 11 Sep 2025 07:16:24 +0000 Subject: [PATCH] Merged in chore/move-enter-details (pull request #2778) Chore/move enter details Approved-by: Anton Gunnarsson --- .../alternative-hotels/map/page.tsx | 7 - .../(standard)/alternative-hotels/page.tsx | 12 +- .../(standard)/select-hotel/map/page.tsx | 14 +- .../(standard)/select-hotel/page.tsx | 14 +- .../(standard)/select-rate/page.tsx | 14 +- apps/partner-sas/app/[lang]/layout.tsx | 12 + apps/partner-sas/app/utils/tracking.ts | 123 ++++++ apps/partner-sas/package.json | 1 + .../(protected)/my-pages/[...path]/page.tsx | 2 +- .../my-pages/profile/edit/page.tsx | 3 +- .../(protected)/my-pages/profile/page.tsx | 3 +- .../gla-payment-callback/page.tsx | 2 +- .../payment-callback/page.tsx | 6 +- .../alternative-hotels/map/page.tsx | 7 - .../(standard)/alternative-hotels/page.tsx | 13 +- .../(standard)/details/page.tsx | 161 +------ .../hotelreservation/(standard)/page.tsx | 5 +- .../(standard)/select-hotel/map/page.tsx | 12 +- .../(standard)/select-hotel/page.tsx | 14 +- .../(standard)/select-rate/page.tsx | 14 +- .../hotelreservation/my-stay/tracking.tsx | 4 +- apps/scandic-web/app/[lang]/(live)/layout.tsx | 2 +- .../app/[lang]/(no-layout)/layout.tsx | 2 +- .../app/[lang]/(partner)/layout.tsx | 2 +- .../hotelreservation/my-stay/tracking.tsx | 4 +- .../components/BookingFlowProviders.tsx | 23 +- .../CampaignOverviewPage/index.tsx | 2 +- .../ContentType/CampaignPage/index.tsx | 3 +- .../DestinationOverviewPage/index.tsx | 2 +- .../DestinationPage/Tracking/index.tsx | 5 +- .../ContentType/HotelPage/index.tsx | 2 +- .../components/ContentType/HotelPage/utils.ts | 2 +- .../ContentType/LoyaltyPage/index.tsx | 2 +- .../ContentType/StartPage/index.tsx | 2 +- .../ContentType/StaticPages/index.tsx | 2 +- .../ContentType/StaticPages/staticPage.ts | 2 +- .../Current/Header/MainMenu/index.tsx | 6 +- .../Current/Header/TopMenu/index.tsx | 4 +- .../components/Current/Tracking.tsx | 2 +- .../components/Forms/Edit/Profile/index.tsx | 2 +- .../components/Forms/Signup/index.tsx | 11 +- .../Header/MainMenu/MobileMenu/index.tsx | 6 +- .../MainMenu/MyPagesMenuWrapper/index.tsx | 4 +- .../components/Header/TopMenu/index.tsx | 4 +- .../BookingConfirmation/Tracking/index.tsx | 4 +- .../BookingConfirmation/Tracking/tracking.ts | 7 +- .../HotelReservation/FindMyBooking/index.tsx | 3 +- .../Steps/ConfirmationStep/index.tsx | 7 +- .../MyStay/Receipt/tracking.tsx | 4 +- .../GuaranteeLateArrival/Form/index.tsx | 15 +- .../Rooms/SingleRoom/Details/Packages.tsx | 4 +- .../MyStay/TrackGuarantee.tsx | 10 +- .../components/MyPages/Surprises/Client.tsx | 2 +- .../SidePeeks/BookedRoomSidePeek/index.tsx | 6 +- .../JoinLoyalty/LoyaltyLoginButton.tsx | 4 +- .../Sidebar/JoinLoyalty/ReadMore/index.tsx | 3 +- .../components/TrackingSDK/index.tsx | 55 --- .../components/Webviews/AccountPage/index.tsx | 3 +- .../components/Webviews/LoyaltyPage/index.tsx | 2 +- apps/scandic-web/constants/webHrefs.ts | 36 -- apps/scandic-web/contexts/Details.ts | 5 - apps/scandic-web/contexts/Details/Room.tsx | 13 - .../hooks/booking/useGuaranteeBooking.ts | 5 +- .../lib/trpc/memoizedRequests/index.ts | 8 - apps/scandic-web/next.config.ts | 14 +- apps/scandic-web/package.json | 1 + .../providers/Details/RoomProvider.tsx | 33 -- .../components/hotelReservation/breakfast.ts | 6 - .../hotelReservation/enterDetails/bedType.ts | 11 - .../hotelReservation/enterDetails/details.ts | 23 - .../enterDetails/hotelHeader.ts | 5 - .../hotelReservation/enterDetails/payment.ts | 23 - .../hotelReservation/enterDetails/section.ts | 9 - .../components/hotelReservation/summary.ts | 22 +- .../types/contexts/details/room.ts | 10 - .../types/contexts/enter-details.ts | 3 - .../types/providers/details/room.ts | 6 - .../types/providers/enter-details.ts | 11 - apps/scandic-web/types/stores/my-stay.ts | 2 +- apps/scandic-web/utils/getErrorMessage.ts | 6 +- apps/scandic-web/utils/tracking/booking.ts | 4 +- .../utils/tracking/componentEvents.ts | 2 +- .../utils/tracking/destinationPage.ts | 2 +- apps/scandic-web/utils/tracking/hotelPage.ts | 2 +- apps/scandic-web/utils/tracking/index.ts | 4 +- apps/scandic-web/utils/tracking/myStay.ts | 24 +- apps/scandic-web/utils/tracking/navigation.ts | 4 +- apps/scandic-web/utils/tracking/payment.ts | 4 +- packages/booking-flow/env/client.ts | 21 + packages/booking-flow/global.d.ts | 6 + .../Receipt/Room/index.tsx | 4 +- .../BedType/bedOptions.module.css | 0 .../EnterDetails/BedType/index.tsx | 19 +- .../EnterDetails/BedType/schema.ts | 1 + .../Breakfast/breakfast.module.css | 0 .../EnterDetails/Breakfast/index.tsx | 16 +- .../EnterDetails/Breakfast/schema.ts | 1 + .../Confirm/Guarantee/guarantee.module.css | 0 .../EnterDetails/Confirm/Guarantee/index.tsx | 17 +- .../EnterDetails/Confirm/confirm.module.css | 0 .../EnterDetails/Confirm/index.tsx | 0 .../Details/MemberPriceModal/index.tsx | 2 +- .../Details/MemberPriceModal/modal.module.css | 0 .../JoinScandicFriendsCard/index.tsx | 12 +- .../joinScandicFriendsCard.module.css | 0 .../Details/Multiroom/details.module.css | 0 .../EnterDetails/Details/Multiroom/index.tsx | 29 +- .../EnterDetails/Details/Multiroom/schema.ts | 22 +- .../RoomOne/JoinScandicFriendsCard/index.tsx | 27 +- .../joinScandicFriendsCard.module.css | 0 .../Details/RoomOne/Signup/index.tsx | 10 +- .../Details/RoomOne/Signup/signup.module.css | 0 .../Details/RoomOne/details.module.css | 0 .../EnterDetails/Details/RoomOne/index.tsx | 44 +- .../EnterDetails/Details/RoomOne/schema.ts | 22 +- .../Details/SpecialRequests/index.tsx | 2 +- .../Details/SpecialRequests/schema.ts | 0 .../specialRequests.module.css | 0 .../EnterDetails/Header/header.module.css | 0 .../components}/EnterDetails/Header/index.tsx | 17 +- .../BookingAlert/bookingAlert.module.css | 0 .../Payment/BookingAlert/index.tsx | 5 +- .../guaranteeDetails.module.css | 0 .../Payment/GuaranteeDetails/index.tsx | 0 .../MixedRatePaymentBreakdown/index.tsx | 2 +- .../mixedRatePaymentBreakdown.module.css | 0 .../PaymentCallback/HandleErrorCallback.tsx | 20 +- .../PaymentCallback/HandleSuccessCallback.tsx | 7 +- .../PaymentCallback/TimeoutSpinner/index.tsx | 5 +- .../TimeoutSpinner/timeoutSpinner.module.css | 0 .../Payment/PaymentCallback/helpers.ts | 0 .../Payment/PaymentCallback/tracking.ts | 2 +- .../EnterDetails/Payment/PaymentClient.tsx | 45 +- .../Payment/TermsAndConditions/index.tsx | 19 +- .../EnterDetails/Payment/helpers.ts | 2 +- .../EnterDetails/Payment/index.tsx | 14 +- .../EnterDetails/Payment/payment.module.css | 0 .../EnterDetails/Payment/schema.ts | 0 .../EnterDetails/PriceChangeData.ts | 5 + .../PriceChangeSummary/index.tsx | 7 +- .../priceChangeSummary.module.css | 0 .../EnterDetails/PriceChangeDialog/index.tsx | 5 +- .../priceChangeDialog.module.css | 0 .../Room/Header/header.module.css | 0 .../EnterDetails/Room/Header/index.tsx | 0 .../EnterDetails/Room/Multiroom.tsx | 27 +- .../lib/components}/EnterDetails/Room/One.tsx | 30 +- .../components}/EnterDetails/Room/utils.ts | 0 .../EnterDetails/Section/index.tsx | 16 +- .../EnterDetails/Section/section.module.css | 0 .../EnterDetails/SelectedRoom/index.tsx | 9 +- .../SelectedRoom/selectedRoom.module.css | 0 .../EnterDetails/StorageCleaner.tsx | 5 +- .../EnterDetails/Summary/Desktop.tsx | 12 +- .../Mobile/BottomSheet/bottomSheet.module.css | 0 .../Summary/Mobile/BottomSheet/index.tsx | 7 +- .../EnterDetails/Summary/Mobile/index.tsx | 13 +- .../Summary/Mobile/mobile.module.css | 0 .../UI/Room/Breakfast/breakfast.module.css | 0 .../Summary/UI/Room/Breakfast/index.tsx | 0 .../EnterDetails/Summary/UI/Room/index.tsx | 6 +- .../Summary/UI/Room/room.module.css | 0 .../EnterDetails/Summary/UI/index.tsx | 28 +- .../EnterDetails/Summary/UI/mapToPrice.ts | 5 +- .../EnterDetails/Summary/UI/ui.module.css | 0 .../EnterDetails/Summary/UI/utils.ts | 6 +- .../EnterDetails/Tracking/index.tsx | 11 +- .../EnterDetails/Tracking/tracking.ts | 15 +- .../EnterDetails/enterDetailsErrors.ts | 31 ++ .../PriceDetailsTable/Row/Price/Packages.tsx | 27 +- .../SelectRate/Tracking/tracking.ts | 2 +- .../lib/components/SidePanel/index.tsx | 9 +- .../EnterDetails/EnterDetailsContext.tsx | 58 ++- .../lib/contexts/EnterDetails/RoomContext.tsx | 59 +++ .../lib/hooks}/useAvailablePaymentOptions.ts | 0 .../lib/hooks}/useHandleBookingStatus.ts | 2 +- .../lib/misc/getFormatedCountryList.ts | 10 + .../lib/misc/selectHotelTracking.ts | 2 +- .../lib/pages/AlternativeHotelsMapPage.tsx | 15 +- .../lib/pages/AlternativeHotelsPage.tsx | 15 +- .../lib/pages/BookingConfirmationPage.tsx | 2 +- .../lib/pages/EnterDetailsPage.module.css | 0 .../lib/pages/EnterDetailsPage.tsx | 168 ++++++++ .../lib/pages/SelectHotelMapPage.tsx | 15 +- .../lib/pages/SelectHotelPage.tsx | 15 +- .../booking-flow/lib/pages/SelectRatePage.tsx | 12 +- .../stores/enter-details/enterDetailsStep.ts | 2 +- .../lib}/stores/enter-details/helpers.ts | 21 +- .../lib}/stores/enter-details/index.ts | 46 +- .../lib/stores/enter-details/types.ts | 42 +- packages/booking-flow/lib/trackingContext.tsx | 21 + .../memoizedRequests/getBreakfastPackages.ts | 12 + .../lib/trpc/memoizedRequests/getHotel.ts | 15 + .../lib/trpc/memoizedRequests/getProfile.ts | 10 + .../getSavedPaymentCardsSafely.ts | 14 + ...etSelectedRoomsAvailabilityEnterDetails.ts | 21 + .../lib/types/membershipFailedError.ts | 1 + .../lib/utils/getRoomFeatureDescription.ts | 2 +- .../lib}/utils/specialRoomType.ts | 0 packages/booking-flow/package.json | 30 +- packages/common/constants/booking.ts | 8 - .../constants/paymentCallbackStatusEnum.ts | 5 + .../routes/bookingTermsAndConditionsRoutes.ts | 12 + .../constants/routes/customerService.ts | 12 + ...indMyBooking.ts => findMyBookingRoutes.ts} | 10 +- .../routes/membershipTermsAndConditions.ts | 12 + .../constants/routes/privacyPolicyRoutes.ts | 12 + .../common}/hooks/useLazyPathname.ts | 1 + .../common}/hooks/usePhoneNumberParsing.ts | 2 +- packages/common/package.json | 1 + .../lib/components/LoginButton/index.tsx | 8 +- packages/tracking/.env.test | 2 + packages/tracking/.gitignore | 40 ++ packages/tracking/eslint.config.mjs | 89 ++++ packages/tracking/global.d.ts | 4 + .../tracking/lib}/TrackingSDK.tsx | 19 +- .../{common/tracking => tracking/lib}/base.ts | 4 +- .../{common/tracking => tracking/lib}/form.ts | 0 packages/tracking/lib/hooks/useLang.ts | 17 + .../tracking => tracking/lib}/pageview.ts | 0 .../tracking => tracking/lib}/types.ts | 31 +- .../lib}/useFormTracking.ts | 0 .../lib}/useTrackHardNavigation.ts | 11 +- .../lib}/useTrackSoftNavigation.ts | 7 +- packages/tracking/lint-staged.config.js | 11 + packages/tracking/package.json | 47 +++ packages/tracking/tsconfig.json | 12 + packages/tracking/vitest-setup.ts | 3 + packages/tracking/vitest.config.ts | 17 + .../routers/contentstack/metadata/output.ts | 15 +- packages/trpc/lib/routers/hotels/output.ts | 3 +- .../lib/routers/hotels/schemas/packages.ts | 3 +- .../hotels/schemas/productTypePrice.ts | 1 + packages/trpc/lib/routers/user/input.ts | 4 +- .../routers/user/{query.ts => query/index.ts} | 104 +---- .../routers/user/query/userTrackingInfo.ts | 92 ++++ packages/trpc/package.json | 1 + yarn.lock | 393 +++--------------- 238 files changed, 1656 insertions(+), 1602 deletions(-) delete mode 100644 apps/scandic-web/components/TrackingSDK/index.tsx delete mode 100644 apps/scandic-web/contexts/Details.ts delete mode 100644 apps/scandic-web/contexts/Details/Room.tsx delete mode 100644 apps/scandic-web/types/components/hotelReservation/breakfast.ts delete mode 100644 apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts delete mode 100644 apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts delete mode 100644 apps/scandic-web/types/components/hotelReservation/enterDetails/section.ts delete mode 100644 apps/scandic-web/types/contexts/enter-details.ts delete mode 100644 apps/scandic-web/types/providers/details/room.ts create mode 100644 packages/booking-flow/env/client.ts rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/BedType/bedOptions.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/BedType/index.tsx (89%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/BedType/schema.ts (59%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Breakfast/breakfast.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Breakfast/index.tsx (92%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Breakfast/schema.ts (63%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Confirm/Guarantee/guarantee.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Confirm/Guarantee/index.tsx (92%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Confirm/confirm.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Confirm/index.tsx (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/MemberPriceModal/index.tsx (97%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/MemberPriceModal/modal.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx (90%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/joinScandicFriendsCard.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/Multiroom/details.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/Multiroom/index.tsx (90%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/Multiroom/schema.ts (79%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx (84%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/joinScandicFriendsCard.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/Signup/index.tsx (90%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/Signup/signup.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/details.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/index.tsx (87%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/RoomOne/schema.ts (79%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/SpecialRequests/index.tsx (98%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/SpecialRequests/schema.ts (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Details/SpecialRequests/specialRequests.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Header/header.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Header/index.tsx (84%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/BookingAlert/bookingAlert.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/BookingAlert/index.tsx (97%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/GuaranteeDetails/guaranteeDetails.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/GuaranteeDetails/index.tsx (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/MixedRatePaymentBreakdown/index.tsx (98%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/MixedRatePaymentBreakdown/mixedRatePaymentBreakdown.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/HandleErrorCallback.tsx (85%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback.tsx (90%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/index.tsx (90%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/TimeoutSpinner/timeoutSpinner.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/helpers.ts (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentCallback/tracking.ts (91%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/PaymentClient.tsx (95%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/TermsAndConditions/index.tsx (85%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/helpers.ts (97%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/index.tsx (54%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/payment.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Payment/schema.ts (100%) create mode 100644 packages/booking-flow/lib/components/EnterDetails/PriceChangeData.ts rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx (97%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/PriceChangeDialog/PriceChangeSummary/priceChangeSummary.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/PriceChangeDialog/index.tsx (96%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/PriceChangeDialog/priceChangeDialog.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Room/Header/header.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Room/Header/index.tsx (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Room/Multiroom.tsx (73%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Room/One.tsx (71%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Room/utils.ts (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Section/index.tsx (81%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Section/section.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/SelectedRoom/index.tsx (93%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/SelectedRoom/selectedRoom.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/StorageCleaner.tsx (85%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/Desktop.tsx (71%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/Mobile/BottomSheet/bottomSheet.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/Mobile/BottomSheet/index.tsx (94%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/Mobile/index.tsx (83%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/Mobile/mobile.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/Room/Breakfast/breakfast.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/Room/Breakfast/index.tsx (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/Room/index.tsx (97%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/Room/room.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/index.tsx (89%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/mapToPrice.ts (96%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/ui.module.css (100%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Summary/UI/utils.ts (72%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Tracking/index.tsx (79%) rename {apps/scandic-web/components/HotelReservation => packages/booking-flow/lib/components}/EnterDetails/Tracking/tracking.ts (96%) create mode 100644 packages/booking-flow/lib/components/EnterDetails/enterDetailsErrors.ts rename apps/scandic-web/providers/EnterDetailsProvider.tsx => packages/booking-flow/lib/contexts/EnterDetails/EnterDetailsContext.tsx (75%) create mode 100644 packages/booking-flow/lib/contexts/EnterDetails/RoomContext.tsx rename {apps/scandic-web/hooks/booking => packages/booking-flow/lib/hooks}/useAvailablePaymentOptions.ts (100%) rename {apps/scandic-web/hooks/booking => packages/booking-flow/lib/hooks}/useHandleBookingStatus.ts (97%) create mode 100644 packages/booking-flow/lib/misc/getFormatedCountryList.ts rename apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/details/page.module.css => packages/booking-flow/lib/pages/EnterDetailsPage.module.css (100%) create mode 100644 packages/booking-flow/lib/pages/EnterDetailsPage.tsx rename apps/scandic-web/types/enums/step.ts => packages/booking-flow/lib/stores/enter-details/enterDetailsStep.ts (59%) rename {apps/scandic-web => packages/booking-flow/lib}/stores/enter-details/helpers.ts (96%) rename {apps/scandic-web => packages/booking-flow/lib}/stores/enter-details/index.ts (90%) rename apps/scandic-web/types/stores/enter-details.ts => packages/booking-flow/lib/stores/enter-details/types.ts (75%) create mode 100644 packages/booking-flow/lib/trpc/memoizedRequests/getBreakfastPackages.ts create mode 100644 packages/booking-flow/lib/trpc/memoizedRequests/getHotel.ts create mode 100644 packages/booking-flow/lib/trpc/memoizedRequests/getProfile.ts create mode 100644 packages/booking-flow/lib/trpc/memoizedRequests/getSavedPaymentCardsSafely.ts create mode 100644 packages/booking-flow/lib/trpc/memoizedRequests/getSelectedRoomsAvailabilityEnterDetails.ts create mode 100644 packages/booking-flow/lib/types/membershipFailedError.ts rename {apps/scandic-web => packages/booking-flow/lib}/utils/specialRoomType.ts (100%) create mode 100644 packages/common/constants/paymentCallbackStatusEnum.ts create mode 100644 packages/common/constants/routes/bookingTermsAndConditionsRoutes.ts create mode 100644 packages/common/constants/routes/customerService.ts rename packages/common/constants/routes/{findMyBooking.ts => findMyBookingRoutes.ts} (68%) create mode 100644 packages/common/constants/routes/membershipTermsAndConditions.ts create mode 100644 packages/common/constants/routes/privacyPolicyRoutes.ts rename {apps/scandic-web => packages/common}/hooks/useLazyPathname.ts (99%) rename {apps/scandic-web => packages/common}/hooks/usePhoneNumberParsing.ts (93%) create mode 100644 packages/tracking/.env.test create mode 100644 packages/tracking/.gitignore create mode 100644 packages/tracking/eslint.config.mjs create mode 100644 packages/tracking/global.d.ts rename {apps/partner-sas/components => packages/tracking/lib}/TrackingSDK.tsx (67%) rename packages/{common/tracking => tracking/lib}/base.ts (84%) rename packages/{common/tracking => tracking/lib}/form.ts (100%) create mode 100644 packages/tracking/lib/hooks/useLang.ts rename packages/{common/tracking => tracking/lib}/pageview.ts (100%) rename packages/{common/tracking => tracking/lib}/types.ts (90%) rename packages/{common/tracking => tracking/lib}/useFormTracking.ts (100%) rename packages/{common/tracking => tracking/lib}/useTrackHardNavigation.ts (92%) rename packages/{common/tracking => tracking/lib}/useTrackSoftNavigation.ts (91%) create mode 100644 packages/tracking/lint-staged.config.js create mode 100644 packages/tracking/package.json create mode 100644 packages/tracking/tsconfig.json create mode 100644 packages/tracking/vitest-setup.ts create mode 100644 packages/tracking/vitest.config.ts rename packages/trpc/lib/routers/user/{query.ts => query/index.ts} (74%) create mode 100644 packages/trpc/lib/routers/user/query/userTrackingInfo.ts diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/map/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/map/page.tsx index b2419ae87..3b6b5a1f7 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/map/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/map/page.tsx @@ -1,6 +1,5 @@ import { AlternativeHotelsMapPage as AlternativeHotelsMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsMapPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import type { LangParams, PageArgs } from "@/types/params" @@ -16,12 +15,6 @@ export default async function AlternativeHotelsMapPage( ( - - )} /> ) diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/page.tsx index ca51ac659..8a43ceeaa 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/alternative-hotels/page.tsx @@ -1,6 +1,5 @@ import { AlternativeHotelsPage as AlternativeHotelsPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import { type LangParams, type PageArgs } from "@/types/params" @@ -12,15 +11,6 @@ export default async function AlternativeHotelsPage( const lang = await getLang() return ( - ( - - )} - /> + ) } diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/map/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/map/page.tsx index 0a632b843..56c73d958 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/map/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/map/page.tsx @@ -1,6 +1,5 @@ import { SelectHotelMapPage as SelectHotelMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelMapPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import type { LangParams, PageArgs } from "@/types/params" @@ -9,16 +8,5 @@ export default async function SelectHotelMapPage(props: PageArgs) { const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> - ) + return } diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/page.tsx index 725117572..05d73b88c 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-hotel/page.tsx @@ -1,6 +1,5 @@ import { SelectHotelPage as SelectHotelPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import type { LangParams, PageArgs } from "@/types/params" @@ -9,16 +8,5 @@ export default async function SelectHotelPage(props: PageArgs) { const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> - ) + return } diff --git a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-rate/page.tsx b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-rate/page.tsx index 8ca937805..7929d8f66 100644 --- a/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-rate/page.tsx +++ b/apps/partner-sas/app/[lang]/hotelreservation/(standard)/select-rate/page.tsx @@ -1,6 +1,5 @@ import { SelectRatePage as SelectRatePagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectRatePage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import { type LangParams, type PageArgs } from "@/types/params" @@ -9,16 +8,5 @@ export default async function SelectRatePage(props: PageArgs) { const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> - ) + return } diff --git a/apps/partner-sas/app/[lang]/layout.tsx b/apps/partner-sas/app/[lang]/layout.tsx index 77b0e30cb..03e588cd3 100644 --- a/apps/partner-sas/app/[lang]/layout.tsx +++ b/apps/partner-sas/app/[lang]/layout.tsx @@ -22,9 +22,15 @@ import { Footer } from "../components/Footer/Footer" import { Header } from "../components/Header/Header" import { trackAccordionItemOpen, + trackBedSelection, trackBookingSearchClick, + trackBreakfastSelection, trackGenericEvent, + trackGlaSaveCardAttempt, + trackLoginClick, trackOpenSidePeek, + trackPaymentEvent, + trackUpdatePaymentMethod, } from "../utils/tracking" import type { Metadata } from "next" @@ -82,6 +88,12 @@ export default async function RootLayout(props: RootLayoutProps) { trackAccordionItemOpen, trackOpenSidePeek, trackGenericEvent, + trackGlaSaveCardAttempt, + trackLoginClick, + trackPaymentEvent, + trackUpdatePaymentMethod, + trackBreakfastSelection, + trackBedSelection, }} > diff --git a/apps/partner-sas/app/utils/tracking.ts b/apps/partner-sas/app/utils/tracking.ts index 1c400d06b..aabc224da 100644 --- a/apps/partner-sas/app/utils/tracking.ts +++ b/apps/partner-sas/app/utils/tracking.ts @@ -1,5 +1,11 @@ "use client" +import type { + PaymentEvent, + PaymentFailEvent, +} from "@scandic-hotels/tracking/types" +import type { BreakfastPackages } from "@scandic-hotels/trpc/routers/hotels/output" + export function trackBookingSearchClick( searchTerm: string, searchType: "hotel" | "destination" @@ -26,3 +32,120 @@ export function trackOpenSidePeek(input: { export function trackGenericEvent(data: any) { console.warn("TODO: Implement trackGenericEvent", { data }) } + +export function trackGlaSaveCardAttempt({ + hotelId, + hasSavedCreditCard, + creditCardType, + lateArrivalGuarantee, +}: { + hotelId: string + hasSavedCreditCard: boolean + creditCardType?: string + lateArrivalGuarantee: "mandatory" | "yes" | "no" | "na" +}) { + console.warn("TODO: Implement trackGlaSaveCardAttempt", { + event: "glaCardSaveAttempt", + hotelInfo: { + hotelId, + lateArrivalGuarantee, + guaranteedProduct: "room", + }, + paymentInfo: { + status: "glacardsaveattempt", + isSavedCreditCard: hasSavedCreditCard, + type: creditCardType, + }, + }) +} + +export function trackLoginClick( + position: + | "top menu" + | "hamburger menu" + | "join scandic friends sidebar" + | "enter details" + | "my stay" +) { + console.warn("TODO: Implement trackLoginClick", { + event: "loginStart", + login: { + position, + action: "login start", + ctaName: "login", + }, + }) +} + +export function trackPaymentEvent(paymentEvent: PaymentEvent) { + console.warn("TODO: Implement trackPaymentEvent", { + event: paymentEvent.event, + hotelInfo: { + hotelId: paymentEvent.hotelId, + }, + paymentInfo: { + isSavedCard: paymentEvent.isSavedCreditCard, + status: paymentEvent.status, + type: paymentEvent.method, + smsEnable: paymentEvent.smsEnable, + errorMessage: isPaymentFailEvent(paymentEvent) + ? paymentEvent.errorMessage + : undefined, + }, + }) +} + +export function trackUpdatePaymentMethod({ method }: { method: string }) { + console.warn("TODO: Implement trackUpdatePaymentMethod", { + event: "paymentSelection", + hotelInfo: { + hotelId: "", // TODO: Needs to be verified with analytics if this should even be here + }, + cta: { + name: method, + }, + }) +} + +export function trackBreakfastSelection({ + breakfastPackage, + hotelId, + units, +}: { + breakfastPackage: BreakfastPackages[number] + hotelId: string + units: number +}) { + console.warn("TODO: Implement trackBreakfastSelection", { + event: "breakfastSelection", + selection: { + name: "breakfast options selection click", + }, + ...(units > 0 && { + ancillaries: [ + { + hotelId, + productCategory: "", + productId: breakfastPackage.code, + productUnits: units, + productPrice: breakfastPackage.localPrice.price * units, + productPoints: 0, + productType: "food", + productName: breakfastPackage.packageType, + }, + ], + }), + }) +} +export function trackBedSelection(bedType: string) { + console.warn("TODO: Implement trackBedSelection", { + event: "bedSelection", + selection: { + name: "bed options selection click", + bedType: bedType, + }, + }) +} +function isPaymentFailEvent(event: PaymentEvent): event is PaymentFailEvent { + return "errorMessage" in event +} diff --git a/apps/partner-sas/package.json b/apps/partner-sas/package.json index 315bce809..43e8cc90e 100644 --- a/apps/partner-sas/package.json +++ b/apps/partner-sas/package.json @@ -21,6 +21,7 @@ "@netlify/plugin-nextjs": "^5.11.2", "@scandic-hotels/booking-flow": "workspace:*", "@scandic-hotels/design-system": "workspace:*", + "@scandic-hotels/tracking": "workspace:*", "@scandic-hotels/trpc": "workspace:*", "@sentry/nextjs": "^8.41.0", "@swc/plugin-formatjs": "^3.2.2", diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx index 3ac801791..d473d4a00 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx @@ -1,11 +1,11 @@ import Image from "@scandic-hotels/design-system/Image" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { serverClient } from "@/lib/trpc/server" import Blocks from "@/components/Blocks" import SectionHeader from "@/components/Section/Header" -import TrackingSDK from "@/components/TrackingSDK" import { getIntl } from "@/i18n" import styles from "./page.module.css" diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/edit/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/edit/page.tsx index a78449883..416d36536 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/edit/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/edit/page.tsx @@ -1,8 +1,9 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" + import { getProfile } from "@/lib/trpc/memoizedRequests" import { serverClient } from "@/lib/trpc/server" import Form from "@/components/Forms/Edit/Profile" -import TrackingSDK from "@/components/TrackingSDK" import styles from "./page.module.css" diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx index 8b2740670..ba50b36bf 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx @@ -1,7 +1,8 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" + import { serverClient } from "@/lib/trpc/server" import Profile from "@/components/MyPages/Profile" -import TrackingSDK from "@/components/TrackingSDK" import type { LangParams, PageArgs } from "@/types/params" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx index e4ef69c45..ec2d9d4c6 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx @@ -1,6 +1,6 @@ import { notFound } from "next/navigation" -import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/booking" +import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum" import { myStay } from "@scandic-hotels/common/constants/routes/myStay" import { logger } from "@scandic-hotels/common/logger" import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/payment-callback/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/payment-callback/page.tsx index 077595d1c..ab97df53e 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/payment-callback/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/payment-callback/page.tsx @@ -1,6 +1,8 @@ import { notFound } from "next/navigation" -import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/booking" +import { HandleErrorCallback } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/HandleErrorCallback" +import { HandleSuccessCallback } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback" +import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum" import { bookingConfirmation, details, @@ -15,8 +17,6 @@ import { isValidSession } from "@scandic-hotels/trpc/utils/session" import { serverClient } from "@/lib/trpc/server" import { auth } from "@/auth" -import HandleErrorCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleErrorCallback" -import HandleSuccessCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback" import type { LangParams, PageArgs } from "@/types/params" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/map/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/map/page.tsx index deb30b8e8..173d7fafe 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/map/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/map/page.tsx @@ -1,6 +1,5 @@ import { AlternativeHotelsMapPage as AlternativeHotelsMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsMapPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import styles from "./page.module.css" @@ -18,12 +17,6 @@ export default async function AlternativeHotelsMapPage( ( - - )} /> ) diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/page.tsx index ed7d4c2b4..fe899b7ca 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/alternative-hotels/page.tsx @@ -1,6 +1,5 @@ import { AlternativeHotelsPage as AlternativeHotelsPagePrimitive } from "@scandic-hotels/booking-flow/pages/AlternativeHotelsPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import { @@ -14,17 +13,7 @@ export default async function AlternativeHotelsPage( ) { const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> + ) } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/details/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/details/page.tsx index 0f265477c..948c8cf53 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/details/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/details/page.tsx @@ -1,167 +1,12 @@ -import { cookies } from "next/headers" -import { notFound } from "next/navigation" -import { Suspense } from "react" - -import FnFNotAllowedAlert from "@scandic-hotels/booking-flow/components/FnFNotAllowedAlert" -import { parseDetailsSearchParams } from "@scandic-hotels/booking-flow/utils/url" -import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends" - -import { - getBreakfastPackages, - getHotel, - getProfileSafely, - getSelectedRoomsAvailabilityEnterDetails, -} from "@/lib/trpc/memoizedRequests" - -import HotelHeader from "@/components/HotelReservation/EnterDetails/Header" -import Payment from "@/components/HotelReservation/EnterDetails/Payment" -import Multiroom from "@/components/HotelReservation/EnterDetails/Room/Multiroom" -import RoomOne from "@/components/HotelReservation/EnterDetails/Room/One" -import DesktopSummary from "@/components/HotelReservation/EnterDetails/Summary/Desktop" -import MobileSummary from "@/components/HotelReservation/EnterDetails/Summary/Mobile" -import EnterDetailsTrackingWrapper from "@/components/HotelReservation/EnterDetails/Tracking" -import RoomProvider from "@/providers/Details/RoomProvider" -import EnterDetailsProvider from "@/providers/EnterDetailsProvider" - -import styles from "./page.module.css" +import { EnterDetailsPage as EnterDetailsPagePrimitive } from "@scandic-hotels/booking-flow/pages/EnterDetailsPage" import type { LangParams, NextSearchParams, PageArgs } from "@/types/params" export default async function DetailsPage( props: PageArgs ) { + const { lang } = await props.params const searchParams = await props.searchParams - const params = await props.params - const { lang } = params - - const selectRoomParams = new URLSearchParams(searchParams) - - const booking = parseDetailsSearchParams(searchParams) - - if (!booking) return notFound() - - if (selectRoomParams.has("activeRoomIndex")) { - selectRoomParams.delete("activeRoomIndex") - } - - if ( - booking.bookingCode && - FamilyAndFriendsCodes.includes(booking.bookingCode) - ) { - const cookieStore = await cookies() - const isInValidFNF = cookieStore.get("sc")?.value !== "1" - - if (isInValidFNF) { - return - } - } - - const breakfastInput = { - adults: 1, - fromDate: booking.fromDate, - hotelId: booking.hotelId, - toDate: booking.toDate, - } - const hotelInput = { - hotelId: booking.hotelId, - // TODO: Remove this from input since it forces - // waterfalls for no other reason than to - // set merchantInformationData.alternatePaymentOptions - // to an empty array - isCardOnlyPayment: false, - language: lang, - } - void getHotel(hotelInput) - void getBreakfastPackages(breakfastInput) - void getProfileSafely() - - const rooms = await getSelectedRoomsAvailabilityEnterDetails({ - booking, - lang, - }) - - const hotelData = await getHotel(hotelInput) - - if (!hotelData || !rooms.length) { - return notFound() - } - - const breakfastPackages = await getBreakfastPackages(breakfastInput) - const user = await getProfileSafely() - - const isCardOnlyPayment = rooms.some((room) => room.mustBeGuaranteed) - const { hotel } = hotelData - // TODO: Temp fix to avoid waterfall fetch and moving this - // logic from the route here for now - if (isCardOnlyPayment) { - hotel.merchantInformationData.alternatePaymentOptions = [] - } - - const firstRoom = rooms[0] - const multirooms = rooms.slice(1) - - const { rateDefinition, rateDefinitionMember } = firstRoom.roomRate - if (user && rateDefinitionMember) { - const rateCode = selectRoomParams.get("room[0].ratecode") - if (rateDefinitionMember.rateCode !== rateCode) { - booking.rooms[0].rateCode = rateDefinitionMember.rateCode - selectRoomParams.set("room[0].ratecode", rateDefinitionMember.rateCode) - booking.rooms[0].counterRateCode = rateDefinition.rateCode - selectRoomParams.set("room[0].counterratecode", rateDefinition.rateCode) - } - } - - // attribute data-footer-spacing used to add spacing - // beneath footer to be able to show entire footer upon - // scrolling down to the bottom of the page - return ( -
- - -
-
- - - - {multirooms.map((room, idx) => ( - // Need to start idx from 1 since first room is - // rendered above - - - - ))} - - - -
- -
- -
-
- ) + return } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx index 8ac40de70..5d1328559 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx @@ -1,9 +1,8 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { TrackingChannelEnum, type TrackingSDKPageData, -} from "@scandic-hotels/common/tracking/types" - -import TrackingSDK from "@/components/TrackingSDK" +} from "@scandic-hotels/tracking/types" import styles from "./page.module.css" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/map/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/map/page.tsx index 7008c7226..24c6a1248 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/map/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/map/page.tsx @@ -1,6 +1,5 @@ import { SelectHotelMapPage as SelectHotelMapPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelMapPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import styles from "./page.module.css" @@ -15,16 +14,7 @@ export default async function SelectHotelMapPage( return (
- ( - - )} - /> +
) } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx index 391b9038f..c4c8f75fa 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx @@ -1,6 +1,5 @@ import { SelectHotelPage as SelectHotelPagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectHotelPage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import type { LangParams, NextSearchParams, PageArgs } from "@/types/params" @@ -11,16 +10,5 @@ export default async function SelectHotelPage( const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> - ) + return } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx index 1d4bec75f..346b8b109 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx @@ -1,6 +1,5 @@ import { SelectRatePage as SelectRatePagePrimitive } from "@scandic-hotels/booking-flow/pages/SelectRatePage" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import { @@ -15,16 +14,5 @@ export default async function SelectRatePage( const searchParams = await props.searchParams const lang = await getLang() - return ( - ( - - )} - /> - ) + return } diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/my-stay/tracking.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/my-stay/tracking.tsx index 052186404..09b65afec 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/my-stay/tracking.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/my-stay/tracking.tsx @@ -1,9 +1,9 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { TrackingChannelEnum, type TrackingSDKPageData, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" export default async function Tracking() { diff --git a/apps/scandic-web/app/[lang]/(live)/layout.tsx b/apps/scandic-web/app/[lang]/(live)/layout.tsx index 070f33af8..64191d25f 100644 --- a/apps/scandic-web/app/[lang]/(live)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(live)/layout.tsx @@ -8,6 +8,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools" import Script from "next/script" import { SessionProvider } from "next-auth/react" +import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner" import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs" import { Lang } from "@scandic-hotels/common/constants/language" import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" @@ -19,7 +20,6 @@ import { BookingFlowProviders } from "@/components/BookingFlowProviders" import CookieBotConsent from "@/components/CookieBot" import Footer from "@/components/Footer" import Header from "@/components/Header" -import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import { RACRouterProvider } from "@/components/RACRouterProvider" import RouteChange from "@/components/RouteChange" import SitewideAlert from "@/components/SitewideAlert" diff --git a/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx b/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx index 652ccc0c5..0336c3a77 100644 --- a/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx @@ -8,6 +8,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools" import Script from "next/script" import { SessionProvider } from "next-auth/react" +import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner" import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs" import { Lang } from "@scandic-hotels/common/constants/language" import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" @@ -16,7 +17,6 @@ import TrpcProvider from "@/lib/trpc/Provider" import { SessionRefresher } from "@/components/Auth/TokenRefresher" import CookieBotConsent from "@/components/CookieBot" -import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import RouteChange from "@/components/RouteChange" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" diff --git a/apps/scandic-web/app/[lang]/(partner)/layout.tsx b/apps/scandic-web/app/[lang]/(partner)/layout.tsx index efdec4a4a..cffda07e8 100644 --- a/apps/scandic-web/app/[lang]/(partner)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(partner)/layout.tsx @@ -7,6 +7,7 @@ import "@scandic-hotels/design-system/style.css" import { ReactQueryDevtools } from "@tanstack/react-query-devtools" import Script from "next/script" +import StorageCleaner from "@scandic-hotels/booking-flow/components/EnterDetails/StorageCleaner" import { NuqsAdapter } from "@scandic-hotels/booking-flow/utils/nuqs" import { Lang } from "@scandic-hotels/common/constants/language" import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" @@ -15,7 +16,6 @@ import TrpcProvider from "@/lib/trpc/Provider" import TokenRefresher from "@/components/Auth/TokenRefresher" import CookieBotConsent from "@/components/CookieBot" -import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import RouteChange from "@/components/RouteChange" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" diff --git a/apps/scandic-web/app/[lang]/webview/(views)/hotelreservation/my-stay/tracking.tsx b/apps/scandic-web/app/[lang]/webview/(views)/hotelreservation/my-stay/tracking.tsx index 052186404..09b65afec 100644 --- a/apps/scandic-web/app/[lang]/webview/(views)/hotelreservation/my-stay/tracking.tsx +++ b/apps/scandic-web/app/[lang]/webview/(views)/hotelreservation/my-stay/tracking.tsx @@ -1,9 +1,9 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { TrackingChannelEnum, type TrackingSDKPageData, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" export default async function Tracking() { diff --git a/apps/scandic-web/components/BookingFlowProviders.tsx b/apps/scandic-web/components/BookingFlowProviders.tsx index 5c400bbc4..4b9285268 100644 --- a/apps/scandic-web/components/BookingFlowProviders.tsx +++ b/apps/scandic-web/components/BookingFlowProviders.tsx @@ -2,11 +2,22 @@ import { BookingFlowContextProvider } from "@scandic-hotels/booking-flow/BookingFlowContextProvider" import { BookingFlowTrackingProvider } from "@scandic-hotels/booking-flow/BookingFlowTrackingProvider" -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" import { useIsUserLoggedIn } from "@/hooks/useIsUserLoggedIn" -import { trackAccordionClick, trackOpenSidePeekEvent } from "@/utils/tracking" -import { trackBookingSearchClick } from "@/utils/tracking/booking" +import { + trackAccordionClick, + trackLoginClick, + trackOpenSidePeekEvent, + trackPaymentEvent, + trackUpdatePaymentMethod, +} from "@/utils/tracking" +import { + trackBedSelection, + trackBookingSearchClick, + trackBreakfastSelection, +} from "@/utils/tracking/booking" +import { trackGlaSaveCardAttempt } from "@/utils/tracking/myStay" import type { ReactNode } from "react" @@ -21,6 +32,12 @@ export function BookingFlowProviders({ children }: { children: ReactNode }) { trackAccordionItemOpen: trackAccordionClick, trackOpenSidePeek: trackOpenSidePeekEvent, trackGenericEvent: trackEvent, + trackGlaSaveCardAttempt, + trackLoginClick, + trackPaymentEvent, + trackUpdatePaymentMethod, + trackBreakfastSelection, + trackBedSelection, }} > {children} diff --git a/apps/scandic-web/components/ContentType/CampaignOverviewPage/index.tsx b/apps/scandic-web/components/ContentType/CampaignOverviewPage/index.tsx index 71c3d05ae..a7b49ee31 100644 --- a/apps/scandic-web/components/ContentType/CampaignOverviewPage/index.tsx +++ b/apps/scandic-web/components/ContentType/CampaignOverviewPage/index.tsx @@ -2,12 +2,12 @@ import { notFound } from "next/navigation" import { Suspense } from "react" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { getCampaignOverviewPage } from "@/lib/trpc/memoizedRequests" import TopCampaign from "@/components/ContentType/CampaignOverviewPage/TopCampaign" import LinkChips from "@/components/TempDesignSystem/LinkChips" -import TrackingSDK from "@/components/TrackingSDK" import Blocks from "./Blocks" import CampaignOverviewPageSkeleton from "./CampaignOverviewPageSkeleton" diff --git a/apps/scandic-web/components/ContentType/CampaignPage/index.tsx b/apps/scandic-web/components/ContentType/CampaignPage/index.tsx index f18e4ebca..33c114356 100644 --- a/apps/scandic-web/components/ContentType/CampaignPage/index.tsx +++ b/apps/scandic-web/components/ContentType/CampaignPage/index.tsx @@ -3,11 +3,10 @@ import { notFound } from "next/navigation" import { Suspense } from "react" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { getCampaignPage } from "@/lib/trpc/memoizedRequests" -import TrackingSDK from "@/components/TrackingSDK" - import Blocks from "./Blocks" import CampaignPageSkeleton from "./CampaignPageSkeleton" import CampaignHero from "./Hero" diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx index f87595905..27f7a0e43 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/index.tsx @@ -2,11 +2,11 @@ import { Suspense } from "react" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { getDestinationOverviewPage } from "@/lib/trpc/memoizedRequests" import Blocks from "@/components/Blocks" -import TrackingSDK from "@/components/TrackingSDK" import { DestinationSearch } from "./DestinationSearch" import HotelsSection from "./HotelsSection" diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Tracking/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Tracking/index.tsx index df9926709..da0148939 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Tracking/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Tracking/index.tsx @@ -3,10 +3,11 @@ import { useSearchParams } from "next/navigation" import { useEffect } from "react" -import TrackingSDK from "@/components/TrackingSDK" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" + import { trackOpenMapView } from "@/utils/tracking/destinationPage" -import type { TrackingSDKPageData } from "@scandic-hotels/common/tracking/types" +import type { TrackingSDKPageData } from "@scandic-hotels/tracking/types" interface DestinationTrackingProps { pageData: TrackingSDKPageData diff --git a/apps/scandic-web/components/ContentType/HotelPage/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/index.tsx index 9a848d573..9bf720fb7 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/index.tsx @@ -5,6 +5,7 @@ import { dt } from "@scandic-hotels/common/dt" import { safeTry } from "@scandic-hotels/common/utils/safeTry" import { Alert } from "@scandic-hotels/design-system/Alert" import Link from "@scandic-hotels/design-system/Link" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { getHotel, @@ -16,7 +17,6 @@ import AccordionSection from "@/components/Blocks/Accordion" import Breadcrumbs from "@/components/Breadcrumbs" import HotelCampaigns from "@/components/ContentType/HotelPage/Campaigns" import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton" -import TrackingSDK from "@/components/TrackingSDK" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import { setFacilityCards } from "@/utils/facilityCards" diff --git a/apps/scandic-web/components/ContentType/HotelPage/utils.ts b/apps/scandic-web/components/ContentType/HotelPage/utils.ts index e548bf92c..bec73f41c 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/utils.ts +++ b/apps/scandic-web/components/ContentType/HotelPage/utils.ts @@ -3,7 +3,7 @@ import { TrackingChannelEnum, type TrackingSDKHotelInfo, type TrackingSDKPageData, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" import { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/components/ContentType/LoyaltyPage/index.tsx b/apps/scandic-web/components/ContentType/LoyaltyPage/index.tsx index 7fe392b85..dc0cdbe8d 100644 --- a/apps/scandic-web/components/ContentType/LoyaltyPage/index.tsx +++ b/apps/scandic-web/components/ContentType/LoyaltyPage/index.tsx @@ -3,6 +3,7 @@ import { Suspense } from "react" import Preamble from "@scandic-hotels/design-system/Preamble" import Title from "@scandic-hotels/design-system/Title" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { serverClient } from "@/lib/trpc/server" @@ -11,7 +12,6 @@ import Hero from "@/components/Hero" import MaxWidth from "@/components/MaxWidth" import Sidebar from "@/components/Sidebar" import SidebarSkeleton from "@/components/Sidebar/SidebarSkeleton" -import TrackingSDK from "@/components/TrackingSDK" import { isLoggedInUser } from "@/utils/isLoggedInUser" import styles from "./loyaltyPage.module.css" diff --git a/apps/scandic-web/components/ContentType/StartPage/index.tsx b/apps/scandic-web/components/ContentType/StartPage/index.tsx index b56bad005..a5b12d87e 100644 --- a/apps/scandic-web/components/ContentType/StartPage/index.tsx +++ b/apps/scandic-web/components/ContentType/StartPage/index.tsx @@ -1,13 +1,13 @@ import { FloatingBookingWidget } from "@scandic-hotels/booking-flow/BookingWidget/FloatingBookingWidget" import Image from "@scandic-hotels/design-system/Image" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum" import { getStartPage } from "@/lib/trpc/memoizedRequests" import Blocks from "@/components/Blocks" import FullWidthCampaign from "@/components/Blocks/FullWidthCampaign" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" import styles from "./startPage.module.css" diff --git a/apps/scandic-web/components/ContentType/StaticPages/index.tsx b/apps/scandic-web/components/ContentType/StaticPages/index.tsx index 66eaf6596..a69e3e57d 100644 --- a/apps/scandic-web/components/ContentType/StaticPages/index.tsx +++ b/apps/scandic-web/components/ContentType/StaticPages/index.tsx @@ -2,6 +2,7 @@ import { Suspense } from "react" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Typography } from "@scandic-hotels/design-system/Typography" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import Blocks from "@/components/Blocks" import HeaderDynamicContent from "@/components/Headers/DynamicContent" @@ -10,7 +11,6 @@ import MeetingPackageWidget from "@/components/MeetingPackageWidget" import Sidebar from "@/components/Sidebar" import SidebarSkeleton from "@/components/Sidebar/SidebarSkeleton" import LinkChips from "@/components/TempDesignSystem/LinkChips" -import TrackingSDK from "@/components/TrackingSDK" import { staticPageVariants } from "./variants" diff --git a/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts b/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts index fd920f360..c526f88ca 100644 --- a/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts +++ b/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts @@ -1,4 +1,4 @@ -import type { TrackingSDKPageData } from "@scandic-hotels/common/tracking/types" +import type { TrackingSDKPageData } from "@scandic-hotels/tracking/types" import type { CollectionPage } from "@scandic-hotels/trpc/types/collectionPage" import type { ContentPage } from "@scandic-hotels/trpc/types/contentPage" import type { VariantProps } from "class-variance-authority" diff --git a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx index 8be45a7f4..fb6f884b8 100644 --- a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx +++ b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx @@ -4,9 +4,10 @@ import { usePathname } from "next/navigation" import { useIntl } from "react-intl" -import { findMyBookingCurrentWebPath } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { findMyBookingCurrentWebPath } from "@scandic-hotels/common/constants/routes/findMyBookingRoutes" import { logout } from "@scandic-hotels/common/constants/routes/handleAuth" import { myPages } from "@scandic-hotels/common/constants/routes/myPages" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" import Image from "@scandic-hotels/design-system/Image" import Link from "@scandic-hotels/design-system/Link" @@ -18,7 +19,6 @@ import useDropdownStore from "@/stores/main-menu" import Avatar from "@/components/MyPages/Avatar" import useLang from "@/hooks/useLang" -import { useLazyPathname } from "@/hooks/useLazyPathname" import { trackClick, trackLoginClick } from "@/utils/tracking" import BookingButton from "../BookingButton" @@ -152,7 +152,7 @@ export function MainMenu({
  • { diff --git a/apps/scandic-web/components/Current/Header/TopMenu/index.tsx b/apps/scandic-web/components/Current/Header/TopMenu/index.tsx index b38d470d3..b3352ab81 100644 --- a/apps/scandic-web/components/Current/Header/TopMenu/index.tsx +++ b/apps/scandic-web/components/Current/Header/TopMenu/index.tsx @@ -75,7 +75,7 @@ export default async function TopMenu({ ) : ( {str} diff --git a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx index 34985eb8c..f51308f39 100644 --- a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx @@ -5,10 +5,10 @@ import { Dialog, Modal } from "react-aria-components" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" -import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { customerService } from "@scandic-hotels/common/constants/routes/customerService" +import { findMyBookingRoutes } from "@scandic-hotels/common/constants/routes/findMyBookingRoutes" import { IconName } from "@scandic-hotels/design-system/Icons/iconName" -import { customerService } from "@/constants/webHrefs" import useDropdownStore from "@/stores/main-menu" import LanguageSwitcher from "@/components/LanguageSwitcher" @@ -71,7 +71,7 @@ export default function MobileMenu({ defaultMessage: "Open menu", }) - const findMyBookingUrl = findMyBooking[lang] + const findMyBookingUrl = findMyBookingRoutes[lang] return ( <> diff --git a/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx b/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx index 2020d48ed..b17a20f80 100644 --- a/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx @@ -4,13 +4,13 @@ import { useSession } from "next-auth/react" import { useIntl } from "react-intl" import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" import { Avatar } from "@scandic-hotels/design-system/Avatar" import { LoginButton } from "@scandic-hotels/design-system/LoginButton" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" import useLang from "@/hooks/useLang" -import { useLazyPathname } from "@/hooks/useLazyPathname" import { isValidClientSession } from "@/utils/clientSession" import { trackLoginClick } from "@/utils/tracking" @@ -73,7 +73,7 @@ export default function MyPagesMenuWrapper() { onClick={() => { trackLoginClick("top menu") }} - pathName={loginPathname} + redirectTo={loginPathname} trackingId="loginStartNewTopMenu" > diff --git a/apps/scandic-web/components/Header/TopMenu/index.tsx b/apps/scandic-web/components/Header/TopMenu/index.tsx index 8a406118a..df3d2dee5 100644 --- a/apps/scandic-web/components/Header/TopMenu/index.tsx +++ b/apps/scandic-web/components/Header/TopMenu/index.tsx @@ -1,4 +1,4 @@ -import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { findMyBookingRoutes } from "@scandic-hotels/common/constants/routes/findMyBookingRoutes" import { IconName } from "@scandic-hotels/design-system/Icons/iconName" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" @@ -26,7 +26,7 @@ export default async function TopMenu() { } const lang = await getLang() - const findMyBookingUrl = findMyBooking[lang] + const findMyBookingUrl = findMyBookingRoutes[lang] return (
    diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/index.tsx index 37a47955d..9a05b8d4e 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/index.tsx @@ -2,13 +2,13 @@ import { useEffect, useState } from "react" +import { clearPaymentInfoSessionStorage } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/helpers" import { useSearchHistory } from "@scandic-hotels/booking-flow/hooks/useSearchHistory" import { useBookingConfirmationStore } from "@scandic-hotels/booking-flow/stores/booking-confirmation" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" -import TrackingSDK from "@/components/TrackingSDK" import useLang from "@/hooks/useLang" -import { clearPaymentInfoSessionStorage } from "../../EnterDetails/Payment/helpers" import { getTracking } from "./tracking" import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts index 20e9e9b9f..97682845c 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts @@ -1,7 +1,9 @@ import { createHash } from "crypto" import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { readPaymentInfoFromSessionStorage } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/helpers" import { invertedBedTypeMap } from "@scandic-hotels/booking-flow/utils/SelectRate" +import { getSpecialRoomType } from "@scandic-hotels/booking-flow/utils/specialRoomType" import { CancellationRuleEnum } from "@scandic-hotels/common/constants/booking" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { RateEnum } from "@scandic-hotels/common/constants/rate" @@ -11,13 +13,10 @@ import { type TrackingSDKHotelInfo, type TrackingSDKPageData, type TrackingSDKPaymentInfo, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" -import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers" -import { getSpecialRoomType } from "@/utils/specialRoomType" - import type { Room } from "@scandic-hotels/booking-flow/types/stores/booking-confirmation" import type { Lang } from "@scandic-hotels/common/constants/language" import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation" diff --git a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx index 236b03ebc..6c6d38cd0 100644 --- a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx @@ -5,6 +5,7 @@ import { useRouter } from "next/navigation" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { customerService } from "@scandic-hotels/common/constants/routes/customerService" import { myStay } from "@scandic-hotels/common/constants/routes/myStay" import { logger } from "@scandic-hotels/common/logger" import Body from "@scandic-hotels/design-system/Body" @@ -15,8 +16,6 @@ import Title from "@scandic-hotels/design-system/Title" import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" -import { customerService } from "@/constants/webHrefs" - import Input from "@/components/TempDesignSystem/Form/Input" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx index 493a688ea..87c8a2cca 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx @@ -3,6 +3,8 @@ import { useIntl } from "react-intl" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" +import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes" +import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes" import { dt } from "@scandic-hotels/common/dt" import { Alert } from "@scandic-hotels/design-system/Alert" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" @@ -13,7 +15,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Link from "@scandic-hotels/design-system/Link" import { Typography } from "@scandic-hotels/design-system/Typography" -import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow" import useLang from "@/hooks/useLang" @@ -182,7 +183,7 @@ export default function ConfirmationStep({ textDecoration="underline" color="Text/Interactive/Secondary" target="_blank" - href={bookingTermsAndConditions[lang]} + href={bookingTermsAndConditionsRoutes[lang]} > {str} @@ -192,7 +193,7 @@ export default function ConfirmationStep({ textDecoration="underline" color="Text/Interactive/Secondary" target="_blank" - href={privacyPolicy[lang]} + href={privacyPolicyRoutes[lang]} > {str} diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/tracking.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/tracking.tsx index 9d6b26451..250540bf0 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/tracking.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/tracking.tsx @@ -1,9 +1,9 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { TrackingChannelEnum, type TrackingSDKPageData, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" -import TrackingSDK from "@/components/TrackingSDK" import { getLang } from "@/i18n/serverContext" export default async function Tracking() { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx index 53e1c345b..18bdc8fd1 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx @@ -3,8 +3,11 @@ import { zodResolver } from "@hookform/resolvers/zod" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { writeGlaToSessionStorage } from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/helpers" import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" +import { bookingTermsAndConditionsRoutes } from "@scandic-hotels/common/constants/routes/bookingTermsAndConditionsRoutes" import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation" +import { privacyPolicyRoutes } from "@scandic-hotels/common/constants/routes/privacyPolicyRoutes" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" @@ -16,11 +19,9 @@ import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" -import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" import { env } from "@/env/client" import { useMyStayStore } from "@/stores/my-stay" -import { writeGlaToSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/helpers" import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking" import useLang from "@/hooks/useLang" import { trackUpdatePaymentMethod } from "@/utils/tracking" @@ -72,7 +73,11 @@ export default function Form() { const savedCreditCard = savedCreditCards?.find( (card) => card.id === data.paymentMethod ) - trackGlaSaveCardAttempt(hotelId, savedCreditCard, "yes") + trackGlaSaveCardAttempt({ + hotelId, + hasSavedCreditCard: !!savedCreditCard, + lateArrivalGuarantee: "yes", + }) if (confirmationNumber) { const card = savedCreditCard ? { @@ -117,7 +122,7 @@ export default function Form() { textDecoration="underline" color="Text/Interactive/Secondary" target="_blank" - href={bookingTermsAndConditions[lang]} + href={bookingTermsAndConditionsRoutes[lang]} onClick={(e) => e.stopPropagation()} > {str} @@ -128,7 +133,7 @@ export default function Form() { textDecoration="underline" color="Text/Interactive/Secondary" target="_blank" - href={privacyPolicy[lang]} + href={privacyPolicyRoutes[lang]} onClick={(e) => e.stopPropagation()} > {str} diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx index a10d32a9e..9198cec47 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx @@ -1,6 +1,6 @@ import { useIntl } from "react-intl" -import { getFeatureDescription } from "@scandic-hotels/booking-flow/utils/getRoomFeatureDescription" +import { getRoomFeatureDescription } from "@scandic-hotels/booking-flow/utils/getRoomFeatureDescription" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { useMyStayStore } from "@/stores/my-stay" @@ -19,7 +19,7 @@ export default function Packages() { ) ) .map((item) => - getFeatureDescription(item.code, item.description, intl) + getRoomFeatureDescription(item.code, item.description, intl) ) || [] ) diff --git a/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx b/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx index 2f4fbda7d..7c3bbc415 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/TrackGuarantee.tsx @@ -3,14 +3,14 @@ import { useRouter } from "next/navigation" import { useEffect } from "react" -import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/booking" -import { trackEvent } from "@scandic-hotels/common/tracking/base" -import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" - import { clearGlaSessionStorage, readGlaFromSessionStorage, -} from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/helpers" +} from "@scandic-hotels/booking-flow/components/EnterDetails/Payment/PaymentCallback/helpers" +import { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum" +import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" +import { trackEvent } from "@scandic-hotels/tracking/base" + import { getAncillarySessionData } from "@/components/HotelReservation/MyStay/utils/ancillaries" import { buildAncillariesTracking, diff --git a/apps/scandic-web/components/MyPages/Surprises/Client.tsx b/apps/scandic-web/components/MyPages/Surprises/Client.tsx index 655241be7..7a3417dd1 100644 --- a/apps/scandic-web/components/MyPages/Surprises/Client.tsx +++ b/apps/scandic-web/components/MyPages/Surprises/Client.tsx @@ -6,6 +6,7 @@ import React, { useState } from "react" import { Dialog, Modal, ModalOverlay } from "react-aria-components" import { useIntl } from "react-intl" +import { customerService } from "@scandic-hotels/common/constants/routes/customerService" import { benefits } from "@scandic-hotels/common/constants/routes/myPages" import { logger } from "@scandic-hotels/common/logger" import Link from "@scandic-hotels/design-system/Link" @@ -17,7 +18,6 @@ import { benefits as webviewBenefits, myPagesWebviews, } from "@/constants/routes/webviews" -import { customerService } from "@/constants/webHrefs" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index dc9564e3e..4c511f870 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -1,6 +1,6 @@ import { useIntl } from "react-intl" -import { getFeatureDescription } from "@scandic-hotels/booking-flow/utils/getRoomFeatureDescription" +import { getRoomFeatureDescription } from "@scandic-hotels/booking-flow/utils/getRoomFeatureDescription" import { sumPackages } from "@scandic-hotels/booking-flow/utils/SelectRate" import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" @@ -25,13 +25,13 @@ import RoomDetails from "./RoomDetails" import styles from "./bookedRoomSidePeek.module.css" +import type { BedTypeSchema } from "@scandic-hotels/booking-flow/stores/enter-details/types" import type { BreakfastPackage } from "@scandic-hotels/trpc/routers/hotels/schemas/packages" import type { BookingConfirmationSchema } from "@scandic-hotels/trpc/types/bookingConfirmation" import type { Child } from "@scandic-hotels/trpc/types/child" import type { Room as HotelRoom } from "@scandic-hotels/trpc/types/hotel" import type { Packages } from "@scandic-hotels/trpc/types/packages" -import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType" import type { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay" import type { SafeUser } from "@/types/user" @@ -353,7 +353,7 @@ export default function BookedRoomSidePeek({ ) ) .map((item) => - getFeatureDescription( + getRoomFeatureDescription( item.code, item.description, intl diff --git a/apps/scandic-web/components/Sidebar/JoinLoyalty/LoyaltyLoginButton.tsx b/apps/scandic-web/components/Sidebar/JoinLoyalty/LoyaltyLoginButton.tsx index d4a3ae174..5fd61d75a 100644 --- a/apps/scandic-web/components/Sidebar/JoinLoyalty/LoyaltyLoginButton.tsx +++ b/apps/scandic-web/components/Sidebar/JoinLoyalty/LoyaltyLoginButton.tsx @@ -2,12 +2,12 @@ import { useIntl } from "react-intl" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { LoginButton } from "@scandic-hotels/design-system/LoginButton" import { Typography } from "@scandic-hotels/design-system/Typography" import useLang from "@/hooks/useLang" -import { useLazyPathname } from "@/hooks/useLazyPathname" import { trackLoginClick } from "@/utils/tracking" export function LoyaltyLoginButton() { @@ -21,7 +21,7 @@ export function LoyaltyLoginButton() { onClick={() => { trackLoginClick("join scandic friends sidebar") }} - pathName={loginPathname} + redirectTo={loginPathname} trackingId="loginJoinLoyalty" > diff --git a/apps/scandic-web/components/Sidebar/JoinLoyalty/ReadMore/index.tsx b/apps/scandic-web/components/Sidebar/JoinLoyalty/ReadMore/index.tsx index c508dda30..0f8a59d0b 100644 --- a/apps/scandic-web/components/Sidebar/JoinLoyalty/ReadMore/index.tsx +++ b/apps/scandic-web/components/Sidebar/JoinLoyalty/ReadMore/index.tsx @@ -1,8 +1,9 @@ +import { membershipTermsAndConditions } from "@scandic-hotels/common/constants/routes/membershipTermsAndConditions" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Link from "@scandic-hotels/design-system/Link" import Subtitle from "@scandic-hotels/design-system/Subtitle" -import { faq, membershipTermsAndConditions } from "@/constants/webHrefs" +import { faq } from "@/constants/webHrefs" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" diff --git a/apps/scandic-web/components/TrackingSDK/index.tsx b/apps/scandic-web/components/TrackingSDK/index.tsx deleted file mode 100644 index 4cd48ab47..000000000 --- a/apps/scandic-web/components/TrackingSDK/index.tsx +++ /dev/null @@ -1,55 +0,0 @@ -"use client" - -import { usePathname } from "next/navigation" - -import { useTrackHardNavigation } from "@scandic-hotels/common/tracking/useTrackHardNavigation" -import { useTrackSoftNavigation } from "@scandic-hotels/common/tracking/useTrackSoftNavigation" -import { trpc } from "@scandic-hotels/trpc/client" - -import useLang from "@/hooks/useLang" - -import type { - TrackingSDKAncillaries, - TrackingSDKHotelInfo, - TrackingSDKPageData, - TrackingSDKPaymentInfo, -} from "@scandic-hotels/common/tracking/types" - -export default function TrackingSDK({ - pageData, - hotelInfo, - paymentInfo, - ancillaries, -}: { - pageData: TrackingSDKPageData - hotelInfo?: TrackingSDKHotelInfo - paymentInfo?: TrackingSDKPaymentInfo - ancillaries?: TrackingSDKAncillaries -}) { - const lang = useLang() - const pathName = usePathname() - const { data, isError } = trpc.user.userTrackingInfo.useQuery({ - lang, - }) - - const userData = isError ? ({ loginStatus: "Error" } as const) : data - - useTrackHardNavigation({ - pageData, - hotelInfo, - paymentInfo, - ancillaries, - userData, - pathName, - }) - useTrackSoftNavigation({ - pageData, - hotelInfo, - paymentInfo, - ancillaries, - userData, - pathName, - }) - - return null -} diff --git a/apps/scandic-web/components/Webviews/AccountPage/index.tsx b/apps/scandic-web/components/Webviews/AccountPage/index.tsx index 573c1425e..bb131cf15 100644 --- a/apps/scandic-web/components/Webviews/AccountPage/index.tsx +++ b/apps/scandic-web/components/Webviews/AccountPage/index.tsx @@ -1,9 +1,10 @@ +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" + import { overview } from "@/constants/routes/webviews" import { serverClient } from "@/lib/trpc/server" import MaxWidth from "@/components/MaxWidth" import Surprises from "@/components/MyPages/Surprises" -import TrackingSDK from "@/components/TrackingSDK" import Blocks from "@/components/Webviews/AccountPage/Blocks" import LinkToOverview from "@/components/Webviews/LinkToOverview" import { getLang } from "@/i18n/serverContext" diff --git a/apps/scandic-web/components/Webviews/LoyaltyPage/index.tsx b/apps/scandic-web/components/Webviews/LoyaltyPage/index.tsx index beeb9b52a..98745705e 100644 --- a/apps/scandic-web/components/Webviews/LoyaltyPage/index.tsx +++ b/apps/scandic-web/components/Webviews/LoyaltyPage/index.tsx @@ -1,9 +1,9 @@ import Title from "@scandic-hotels/design-system/Title" +import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK" import { serverClient } from "@/lib/trpc/server" import MaxWidth from "@/components/MaxWidth" -import TrackingSDK from "@/components/TrackingSDK" import LinkToOverview from "@/components/Webviews/LinkToOverview" import Blocks from "./Blocks" diff --git a/apps/scandic-web/constants/webHrefs.ts b/apps/scandic-web/constants/webHrefs.ts index 921a9f201..1185f0563 100644 --- a/apps/scandic-web/constants/webHrefs.ts +++ b/apps/scandic-web/constants/webHrefs.ts @@ -2,24 +2,6 @@ import { Lang } from "@scandic-hotels/common/constants/language" import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" -export const bookingTermsAndConditions: LangRoute = { - da: `/${Lang.da}/kundeservice/politikker/bookingsvilkar`, - de: `/${Lang.de}/kundenbetreuung/richtlinien/reservierungsbedingungen`, - en: `/${Lang.en}/customer-service/policies/booking-terms`, - fi: `/${Lang.fi}/asiakaspalvelu/ehdot/varausehdot`, - no: `/${Lang.no}/kundeservice/betingelser/reservasjonsbetingelser`, - sv: `/${Lang.sv}/kundservice/villkor/bokningsvillkor`, -} - -export const membershipTermsAndConditions: LangRoute = { - da: `/${Lang.da}/kundeservice/politikker/scandic-friends-betingelser`, - de: `/${Lang.de}/kundenbetreuung/richtlinien/scandic-friends-allgemeine-geschaeftsbedingungen`, - en: `/${Lang.en}/customer-service/policies/scandic-friends`, - fi: `/${Lang.fi}/asiakaspalvelu/ehdot/scandic-friends`, - no: `/${Lang.no}/kundeservice/betingelser/scandic-friends-betingelser`, - sv: `/${Lang.sv}/kundservice/villkor/scandic-friends`, -} - export const sasPartnershipTermsAndConditions: LangRoute = { da: `/${Lang.da}/kundeservice/politikker/scandic-friends-betingelser/sas-eurobonus`, de: `/${Lang.de}/kundenbetreuung/richtlinien/scandic-friends-allgemeine-geschaeftsbedingungen/sas-eurobonus`, @@ -46,21 +28,3 @@ export const partners: LangRoute = { no: `/${Lang.no}/scandic-friends/partnere`, sv: `/${Lang.sv}/scandic-friends/partners`, } - -export const privacyPolicy: LangRoute = { - da: `/${Lang.da}/kundeservice/politikker/privatliv`, - de: `/${Lang.de}/kundenbetreuung/richtlinien/datenschutz`, - en: `/${Lang.en}/customer-service/policies/privacy`, - fi: `/${Lang.fi}/asiakaspalvelu/ehdot/tietosuojaseloste`, - no: `/${Lang.no}/kundeservice/personvernpolicy`, - sv: `/${Lang.sv}/kundservice/villkor/integritetspolicy`, -} - -export const customerService: LangRoute = { - da: `/${Lang.da}/kundeservice`, - de: `/${Lang.de}/kundenbetreuung`, - en: `/${Lang.en}/customer-service`, - fi: `/${Lang.fi}/asiakaspalvelu`, - no: `/${Lang.no}/kundeservice`, - sv: `/${Lang.sv}/kundservice`, -} diff --git a/apps/scandic-web/contexts/Details.ts b/apps/scandic-web/contexts/Details.ts deleted file mode 100644 index 7bbe35599..000000000 --- a/apps/scandic-web/contexts/Details.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createContext } from "react" - -import type { DetailsStore } from "@/types/contexts/enter-details" - -export const DetailsContext = createContext(null) diff --git a/apps/scandic-web/contexts/Details/Room.tsx b/apps/scandic-web/contexts/Details/Room.tsx deleted file mode 100644 index a60710fce..000000000 --- a/apps/scandic-web/contexts/Details/Room.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createContext, useContext } from "react" - -import type { RoomContextValue } from "@/types/contexts/details/room" - -export const RoomContext = createContext(null) - -export function useRoomContext() { - const ctx = useContext(RoomContext) - if (!ctx) { - throw new Error("Missing context value [RoomContext]") - } - return ctx -} diff --git a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts index b314390f2..eebdd8869 100644 --- a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts +++ b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts @@ -2,13 +2,12 @@ import { useRouter } from "next/navigation" import { useCallback, useEffect, useState } from "react" import { useIntl } from "react-intl" -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { useHandleBookingStatus } from "@scandic-hotels/booking-flow/hooks/useHandleBookingStatus" import { toast } from "@scandic-hotels/design-system/Toast" +import { trackEvent } from "@scandic-hotels/tracking/base" import { trpc } from "@scandic-hotels/trpc/client" import { BookingStatusEnum } from "@scandic-hotels/trpc/enums/bookingStatus" -import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus" - const maxRetries = 15 const retryInterval = 2000 diff --git a/apps/scandic-web/lib/trpc/memoizedRequests/index.ts b/apps/scandic-web/lib/trpc/memoizedRequests/index.ts index 5f354fec6..f0f7845bb 100644 --- a/apps/scandic-web/lib/trpc/memoizedRequests/index.ts +++ b/apps/scandic-web/lib/trpc/memoizedRequests/index.ts @@ -12,7 +12,6 @@ import type { Country } from "@scandic-hotels/trpc/types/country" import type { HotelInput } from "@scandic-hotels/trpc/types/hotel" import type { AncillaryPackagesInput, - BreackfastPackagesInput, PackagesInput, } from "@scandic-hotels/trpc/types/packages" @@ -123,13 +122,6 @@ export const getSiteConfig = cache(async function getMemoizedSiteConfig( return caller.contentstack.base.siteConfig({ lang }) }) -export const getBreakfastPackages = cache( - async function getMemoizedBreakfastPackages(input: BreackfastPackagesInput) { - const caller = await serverClient() - return caller.hotel.packages.breakfast(input) - } -) - export const getAncillaryPackages = cache( async function getMemoizedAncillaryPackages(input: AncillaryPackagesInput) { const caller = await serverClient() diff --git a/apps/scandic-web/next.config.ts b/apps/scandic-web/next.config.ts index ae4ecd991..50de51cb5 100644 --- a/apps/scandic-web/next.config.ts +++ b/apps/scandic-web/next.config.ts @@ -3,7 +3,7 @@ import { fileURLToPath } from "node:url" import * as Sentry from "@sentry/nextjs" import createJiti from "jiti" -import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { findMyBookingRoutes } from "@scandic-hotels/common/constants/routes/findMyBookingRoutes" import { login, logout, @@ -313,27 +313,27 @@ const nextConfig = { }, // Find my booking { - source: findMyBooking.en, + source: findMyBookingRoutes.en, destination: "/en/hotelreservation/get-booking", }, { - source: findMyBooking.da, + source: findMyBookingRoutes.da, destination: "/da/hotelreservation/get-booking", }, { - source: findMyBooking.de, + source: findMyBookingRoutes.de, destination: "/de/hotelreservation/get-booking", }, { - source: findMyBooking.fi, + source: findMyBookingRoutes.fi, destination: "/fi/hotelreservation/get-booking", }, { - source: findMyBooking.no, + source: findMyBookingRoutes.no, destination: "/no/hotelreservation/get-booking", }, { - source: findMyBooking.sv, + source: findMyBookingRoutes.sv, destination: "/sv/hotelreservation/get-booking", }, // My stay diff --git a/apps/scandic-web/package.json b/apps/scandic-web/package.json index 3ff6a4324..e9a89c06b 100644 --- a/apps/scandic-web/package.json +++ b/apps/scandic-web/package.json @@ -41,6 +41,7 @@ "@scandic-hotels/booking-flow": "workspace:*", "@scandic-hotels/common": "workspace:*", "@scandic-hotels/design-system": "workspace:*", + "@scandic-hotels/tracking": "workspace:*", "@scandic-hotels/trpc": "workspace:*", "@sentry/nextjs": "^8.41.0", "@swc/plugin-formatjs": "^3.2.2", diff --git a/apps/scandic-web/providers/Details/RoomProvider.tsx b/apps/scandic-web/providers/Details/RoomProvider.tsx index 06d3f4b36..e69de29bb 100644 --- a/apps/scandic-web/providers/Details/RoomProvider.tsx +++ b/apps/scandic-web/providers/Details/RoomProvider.tsx @@ -1,33 +0,0 @@ -"use client" - -import { useEnterDetailsStore } from "@/stores/enter-details" - -import { RoomContext } from "@/contexts/Details/Room" - -import type { RoomProviderProps } from "@/types/providers/details/room" - -export default function RoomProvider({ children, idx }: RoomProviderProps) { - const { actions, isComplete, room, steps } = useEnterDetailsStore( - (state) => ({ - actions: state.rooms[idx].actions, - isComplete: state.rooms[idx].isComplete, - room: state.rooms[idx].room, - steps: state.rooms[idx].steps, - }) - ) - - return ( - - {children} - - ) -} diff --git a/apps/scandic-web/types/components/hotelReservation/breakfast.ts b/apps/scandic-web/types/components/hotelReservation/breakfast.ts deleted file mode 100644 index 363f22c9e..000000000 --- a/apps/scandic-web/types/components/hotelReservation/breakfast.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { z } from "zod" - -import type { breakfastFormSchema } from "@/components/HotelReservation/EnterDetails/Breakfast/schema" - -export interface BreakfastFormSchema - extends z.output {} diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/bedType.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/bedType.ts index ed01e977f..71a0ba4db 100644 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/bedType.ts +++ b/apps/scandic-web/types/components/hotelReservation/enterDetails/bedType.ts @@ -1,14 +1,3 @@ -import type { z } from "zod" - -import type { bedTypeFormSchema } from "@/components/HotelReservation/EnterDetails/BedType/schema" - -export interface BedTypeFormSchema extends z.output {} - -export type BedTypeSchema = { - description: string - type: string - roomTypeCode: string -} export type BedTypeInfoProps = { hasMultipleBedTypes: boolean } diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts index 040c5aa67..49ba15c3e 100644 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts +++ b/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts @@ -1,38 +1,15 @@ import type { BookingSearchType } from "@scandic-hotels/booking-flow/searchType" -import type { productTypePointsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice" import type { Child } from "@scandic-hotels/trpc/types/child" import type { PackageEnum } from "@scandic-hotels/trpc/types/packages" import type { Product } from "@scandic-hotels/trpc/types/roomAvailability" -import type { z } from "zod" -import type { SafeUser } from "@/types/user" -import type { getMultiroomDetailsSchema } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema" -import type { - guestDetailsSchema, - signedInDetailsSchema, -} from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema" import type { Price } from "../price" -export type DetailsSchema = z.output -export type MultiroomDetailsSchema = z.output< - ReturnType -> -export type SignedInDetailsSchema = z.output -export type ProductTypePointsSchema = z.output - export interface RoomPrice { perNight: Price perStay: Price } -export interface DetailsProps { - user: SafeUser -} - -export type JoinScandicFriendsCardProps = { - name?: string -} - export type RoomRate = Product export type DetailsBooking = { diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts deleted file mode 100644 index 33fda70ea..000000000 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { HotelData } from "@scandic-hotels/trpc/types/hotel" - -export interface HotelHeaderProps { - hotelData: HotelData & { url: string | null } -} diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts deleted file mode 100644 index dff23595a..000000000 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" -import type { CreditCard } from "@scandic-hotels/trpc/types/user" - -export interface PaymentProps { - otherPaymentOptions: PaymentMethodEnum[] - supportedCards: PaymentMethodEnum[] -} - -export interface PaymentClientProps - extends Omit { - savedCreditCards: CreditCard[] | null - isUserLoggedIn: boolean -} - -export type PriceChangeData = Array<{ - roomPrice: number - totalPrice: number - packagePrice?: number -} | null> - -export interface TermsAndConditionsProps { - isFlexBookingTerms: boolean -} diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/section.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/section.ts deleted file mode 100644 index 12f27c498..000000000 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/section.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { StepEnum } from "@/types/enums/step" - -export interface SectionProps { - header: string - label: string - additionalInfo?: string | null - step: StepEnum - disabled?: boolean -} diff --git a/apps/scandic-web/types/components/hotelReservation/summary.ts b/apps/scandic-web/types/components/hotelReservation/summary.ts index e979c0e33..ab398f16e 100644 --- a/apps/scandic-web/types/components/hotelReservation/summary.ts +++ b/apps/scandic-web/types/components/hotelReservation/summary.ts @@ -1,14 +1,8 @@ import type { SelectRateBooking } from "@scandic-hotels/booking-flow/types/components/selectRate/selectRate" -import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import type { Child } from "@scandic-hotels/trpc/types/child" import type { Packages } from "@scandic-hotels/trpc/types/packages" -import type { RoomState } from "@/types/stores/enter-details" -import type { - DetailsBooking, - RoomPrice, - RoomRate, -} from "./enterDetails/details" +import type { RoomPrice, RoomRate } from "./enterDetails/details" import type { Price } from "./price" export type RoomsData = { @@ -21,20 +15,6 @@ export type RoomsData = { packages: Packages | null } -export interface SummaryProps { - isUserLoggedIn: boolean -} - -export interface EnterDetailsSummaryProps { - booking: DetailsBooking - isUserLoggedIn: boolean - totalPrice: Price - vat: number - rooms: RoomState[] - toggleSummaryOpen: () => void - defaultCurrency: CurrencyEnum -} - export interface SelectRateSummaryProps { booking: SelectRateBooking isMember: boolean diff --git a/apps/scandic-web/types/contexts/details/room.ts b/apps/scandic-web/types/contexts/details/room.ts index b016baba3..e69de29bb 100644 --- a/apps/scandic-web/types/contexts/details/room.ts +++ b/apps/scandic-web/types/contexts/details/room.ts @@ -1,10 +0,0 @@ -import type { RoomState } from "@/types/stores/enter-details" - -export interface RoomContextValue { - actions: RoomState["actions"] - isComplete: RoomState["isComplete"] - idx: number - room: RoomState["room"] - roomNr: number - steps: RoomState["steps"] -} diff --git a/apps/scandic-web/types/contexts/enter-details.ts b/apps/scandic-web/types/contexts/enter-details.ts deleted file mode 100644 index 4cabf007c..000000000 --- a/apps/scandic-web/types/contexts/enter-details.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { createDetailsStore } from "@/stores/enter-details" - -export type DetailsStore = ReturnType diff --git a/apps/scandic-web/types/providers/details/room.ts b/apps/scandic-web/types/providers/details/room.ts deleted file mode 100644 index b18c6466e..000000000 --- a/apps/scandic-web/types/providers/details/room.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Room } from "@scandic-hotels/trpc/types/room" - -export interface RoomProviderProps extends React.PropsWithChildren { - idx: number - room: Room -} diff --git a/apps/scandic-web/types/providers/enter-details.ts b/apps/scandic-web/types/providers/enter-details.ts index 20e377833..5b18194b5 100644 --- a/apps/scandic-web/types/providers/enter-details.ts +++ b/apps/scandic-web/types/providers/enter-details.ts @@ -5,14 +5,3 @@ import type { Room } from "@scandic-hotels/trpc/types/room" import type { SafeUser } from "@/types/user" import type { DetailsBooking } from "../components/hotelReservation/enterDetails/details" - -export interface DetailsProviderProps extends React.PropsWithChildren { - booking: DetailsBooking - breakfastPackages: BreakfastPackages - lang: Lang - rooms: Room[] - searchParamsStr: string - user: SafeUser - vat: number - roomCategories: RoomCategories -} diff --git a/apps/scandic-web/types/stores/my-stay.ts b/apps/scandic-web/types/stores/my-stay.ts index 560c102d9..4da6e3b1e 100644 --- a/apps/scandic-web/types/stores/my-stay.ts +++ b/apps/scandic-web/types/stores/my-stay.ts @@ -1,3 +1,4 @@ +import type { BedTypeSchema } from "@scandic-hotels/booking-flow/stores/enter-details/types" import type { BreakfastPackage } from "@scandic-hotels/trpc/routers/hotels/schemas/packages" import type { BookingConfirmation } from "@scandic-hotels/trpc/types/bookingConfirmation" import type { Child } from "@scandic-hotels/trpc/types/child" @@ -9,7 +10,6 @@ import type { import type { CreditCard } from "@scandic-hotels/trpc/types/user" import type { IntlShape } from "react-intl" -import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType" import type { RoomPrice } from "@/types/components/hotelReservation/enterDetails/details" import type { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay" import type { Packages } from "@/types/components/myPages/myStay/ancillaries" diff --git a/apps/scandic-web/utils/getErrorMessage.ts b/apps/scandic-web/utils/getErrorMessage.ts index d4ba22ff1..6f8524ee0 100644 --- a/apps/scandic-web/utils/getErrorMessage.ts +++ b/apps/scandic-web/utils/getErrorMessage.ts @@ -1,10 +1,12 @@ +import { + multiroomErrors, + roomOneErrors, +} from "@scandic-hotels/booking-flow/components/EnterDetails/enterDetailsErrors" import { logger } from "@scandic-hotels/common/logger" import { phoneErrors } from "@scandic-hotels/common/utils/zod/phoneValidator" import { signupErrors } from "@scandic-hotels/trpc/routers/user/schemas" import { editProfileErrors } from "@/components/Forms/Edit/Profile/schema" -import { multiroomErrors } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema" -import { roomOneErrors } from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema" import { findMyBookingErrors } from "@/components/HotelReservation/FindMyBooking/schema" import type { IntlShape } from "react-intl" diff --git a/apps/scandic-web/utils/tracking/booking.ts b/apps/scandic-web/utils/tracking/booking.ts index bff2af37d..e9e275d76 100644 --- a/apps/scandic-web/utils/tracking/booking.ts +++ b/apps/scandic-web/utils/tracking/booking.ts @@ -1,8 +1,8 @@ "use client" -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" -import type { LowestRoomPriceEvent } from "@scandic-hotels/common/tracking/types" +import type { LowestRoomPriceEvent } from "@scandic-hotels/tracking/types" import type { BreakfastPackages } from "@scandic-hotels/trpc/routers/hotels/output" export function trackLowestRoomPrice(event: LowestRoomPriceEvent) { diff --git a/apps/scandic-web/utils/tracking/componentEvents.ts b/apps/scandic-web/utils/tracking/componentEvents.ts index b1cf0b626..3d6077e68 100644 --- a/apps/scandic-web/utils/tracking/componentEvents.ts +++ b/apps/scandic-web/utils/tracking/componentEvents.ts @@ -1,5 +1,5 @@ "use client" -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" export function trackAccordionClick(option: string) { trackEvent({ diff --git a/apps/scandic-web/utils/tracking/destinationPage.ts b/apps/scandic-web/utils/tracking/destinationPage.ts index 452d4d3f7..7dcf0125c 100644 --- a/apps/scandic-web/utils/tracking/destinationPage.ts +++ b/apps/scandic-web/utils/tracking/destinationPage.ts @@ -1,4 +1,4 @@ -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" export function trackSortingChangeEvent(sortOption: string) { trackEvent({ diff --git a/apps/scandic-web/utils/tracking/hotelPage.ts b/apps/scandic-web/utils/tracking/hotelPage.ts index 8c33fbb28..bbcb7ace4 100644 --- a/apps/scandic-web/utils/tracking/hotelPage.ts +++ b/apps/scandic-web/utils/tracking/hotelPage.ts @@ -1,4 +1,4 @@ -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" export function trackHotelMapClick() { trackEvent({ diff --git a/apps/scandic-web/utils/tracking/index.ts b/apps/scandic-web/utils/tracking/index.ts index 5b344c075..67f2e5628 100644 --- a/apps/scandic-web/utils/tracking/index.ts +++ b/apps/scandic-web/utils/tracking/index.ts @@ -12,9 +12,9 @@ export { trackSocialMediaClick, } from "./navigation" export { trackPaymentEvent, trackUpdatePaymentMethod } from "./payment" -export { trackClick } from "@scandic-hotels/common/tracking/base" +export { trackClick } from "@scandic-hotels/tracking/base" export { createSDKPageObject, trackPageView, trackPageViewStart, -} from "@scandic-hotels/common/tracking/pageview" +} from "@scandic-hotels/tracking/pageview" diff --git a/apps/scandic-web/utils/tracking/myStay.ts b/apps/scandic-web/utils/tracking/myStay.ts index 021499b08..b28a0f77e 100644 --- a/apps/scandic-web/utils/tracking/myStay.ts +++ b/apps/scandic-web/utils/tracking/myStay.ts @@ -1,5 +1,5 @@ import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import type { PackageSchema } from "@scandic-hotels/trpc/types/bookingConfirmation" @@ -35,13 +35,17 @@ export function trackMyStayPageLink(ctaName: string) { }) } -type LateArrivalGuarantee = "mandatory" | "yes" | "no" | "na" - -export function trackGlaSaveCardAttempt( - hotelId: string, - savedCreditCard: CreditCard | undefined, - lateArrivalGuarantee: LateArrivalGuarantee -) { +export function trackGlaSaveCardAttempt({ + hotelId, + hasSavedCreditCard, + creditCardType, + lateArrivalGuarantee, +}: { + hotelId: string + hasSavedCreditCard: boolean + creditCardType?: string + lateArrivalGuarantee: "mandatory" | "yes" | "no" | "na" +}) { trackEvent({ event: "glaCardSaveAttempt", hotelInfo: { @@ -51,8 +55,8 @@ export function trackGlaSaveCardAttempt( }, paymentInfo: { status: "glacardsaveattempt", - isSavedCreditCard: !!savedCreditCard, - type: savedCreditCard?.cardType, + isSavedCreditCard: hasSavedCreditCard, + type: creditCardType, }, }) } diff --git a/apps/scandic-web/utils/tracking/navigation.ts b/apps/scandic-web/utils/tracking/navigation.ts index 27addb9ba..6cf9d8c68 100644 --- a/apps/scandic-web/utils/tracking/navigation.ts +++ b/apps/scandic-web/utils/tracking/navigation.ts @@ -1,6 +1,6 @@ -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" -import type { TrackingPosition } from "@scandic-hotels/common/tracking/types" +import type { TrackingPosition } from "@scandic-hotels/tracking/types" export function trackFooterClick(group: string, name: string) { trackEvent({ diff --git a/apps/scandic-web/utils/tracking/payment.ts b/apps/scandic-web/utils/tracking/payment.ts index ef8260037..4bbb46e88 100644 --- a/apps/scandic-web/utils/tracking/payment.ts +++ b/apps/scandic-web/utils/tracking/payment.ts @@ -1,9 +1,9 @@ -import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { trackEvent } from "@scandic-hotels/tracking/base" import type { PaymentEvent, PaymentFailEvent, -} from "@scandic-hotels/common/tracking/types" +} from "@scandic-hotels/tracking/types" function isPaymentFailEvent(event: PaymentEvent): event is PaymentFailEvent { return "errorMessage" in event diff --git a/packages/booking-flow/env/client.ts b/packages/booking-flow/env/client.ts new file mode 100644 index 000000000..cad3140da --- /dev/null +++ b/packages/booking-flow/env/client.ts @@ -0,0 +1,21 @@ +import { createEnv } from "@t3-oss/env-nextjs" +import { z } from "zod" + +export const env = createEnv({ + client: { + NEXT_PUBLIC_NODE_ENV: z.enum(["development", "test", "production"]), + NEXT_PUBLIC_PORT: z.string().default("3000"), + // NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().default("development"), + // NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.001), + // NEXT_PUBLIC_PUBLIC_URL: z.string().optional(), + }, + emptyStringAsUndefined: true, + runtimeEnv: { + NEXT_PUBLIC_NODE_ENV: process.env.NODE_ENV, + NEXT_PUBLIC_PORT: process.env.NEXT_PUBLIC_PORT, + // NEXT_PUBLIC_SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, + // NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: + // process.env.NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE, + // NEXT_PUBLIC_PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, + }, +}) diff --git a/packages/booking-flow/global.d.ts b/packages/booking-flow/global.d.ts index 9b2abb356..b9b55f677 100644 --- a/packages/booking-flow/global.d.ts +++ b/packages/booking-flow/global.d.ts @@ -2,3 +2,9 @@ import "@scandic-hotels/common/global.d.ts" import "@scandic-hotels/trpc/types.d.ts" import "@scandic-hotels/trpc/auth.d.ts" import "@scandic-hotels/trpc/jwt.d.ts" + +declare global { + interface Window { + ApplePaySession: (() => void) | undefined + } +} diff --git a/packages/booking-flow/lib/components/BookingConfirmation/Receipt/Room/index.tsx b/packages/booking-flow/lib/components/BookingConfirmation/Receipt/Room/index.tsx index 73e0d9720..41e4b0d06 100644 --- a/packages/booking-flow/lib/components/BookingConfirmation/Receipt/Room/index.tsx +++ b/packages/booking-flow/lib/components/BookingConfirmation/Receipt/Room/index.tsx @@ -13,7 +13,7 @@ import { Typography } from "@scandic-hotels/design-system/Typography" import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" import { useBookingConfirmationStore } from "../../../../stores/booking-confirmation" -import { getFeatureDescription } from "../../../../utils/getRoomFeatureDescription" +import { getRoomFeatureDescription } from "../../../../utils/getRoomFeatureDescription" import Breakfast from "./Breakfast" import RoomSkeletonLoader from "./RoomSkeletonLoader" @@ -183,7 +183,7 @@ export function ReceiptRoom({

    - {getFeatureDescription( + {getRoomFeatureDescription( feature.code, feature.description, intl diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/BedType/bedOptions.module.css b/packages/booking-flow/lib/components/EnterDetails/BedType/bedOptions.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/BedType/bedOptions.module.css rename to packages/booking-flow/lib/components/EnterDetails/BedType/bedOptions.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/BedType/index.tsx b/packages/booking-flow/lib/components/EnterDetails/BedType/index.tsx similarity index 89% rename from apps/scandic-web/components/HotelReservation/EnterDetails/BedType/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/BedType/index.tsx index 8f21b3dc3..96f617781 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/BedType/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/BedType/index.tsx @@ -4,26 +4,22 @@ import { zodResolver } from "@hookform/resolvers/zod" import { useCallback, useEffect, useState } from "react" import { FormProvider, useForm } from "react-hook-form" -import { BED_TYPE_ICONS } from "@scandic-hotels/booking-flow/bedTypeIcons" import RadioCard from "@scandic-hotels/design-system/Form/RadioCard" import { BedTypeEnum, type ExtraBedTypeEnum, } from "@scandic-hotels/trpc/enums/bedType" -import { useEnterDetailsStore } from "@/stores/enter-details" - -import { useRoomContext } from "@/contexts/Details/Room" -import { trackBedSelection } from "@/utils/tracking" - -import { bedTypeFormSchema } from "./schema" +import { useRoomContext } from "../../../contexts/EnterDetails/RoomContext" +import { BED_TYPE_ICONS } from "../../../misc/bedTypeIcons" +import { useEnterDetailsStore } from "../../../stores/enter-details" +import { useTrackingContext } from "../../../trackingContext" +import { type BedTypeFormSchema, bedTypeFormSchema } from "./schema" import styles from "./bedOptions.module.css" import type { IconProps } from "@scandic-hotels/design-system/Icons" -import type { BedTypeFormSchema } from "@/types/components/hotelReservation/enterDetails/bedType" - export default function BedType() { const availableBeds = useEnterDetailsStore((state) => state.availableBeds) const { @@ -33,6 +29,8 @@ export default function BedType() { const initialBedType = bedType?.roomTypeCode const [previousBedType, setPreviousBedType] = useState("") + const { trackBedSelection } = useTrackingContext() + const methods = useForm({ criteriaMode: "all", mode: "all", @@ -53,10 +51,11 @@ export default function BedType() { type: matchingRoom.type, } updateBedType(bedType) + trackBedSelection(bedType.description) } }, - [bedTypes, updateBedType] + [bedTypes, updateBedType, trackBedSelection] ) const selectedBedType = methods.watch("bedType") diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/BedType/schema.ts b/packages/booking-flow/lib/components/EnterDetails/BedType/schema.ts similarity index 59% rename from apps/scandic-web/components/HotelReservation/EnterDetails/BedType/schema.ts rename to packages/booking-flow/lib/components/EnterDetails/BedType/schema.ts index 977076464..acccd2a3d 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/BedType/schema.ts +++ b/packages/booking-flow/lib/components/EnterDetails/BedType/schema.ts @@ -1,5 +1,6 @@ import { z } from "zod" +export type BedTypeFormSchema = z.infer export const bedTypeFormSchema = z.object({ bedType: z.string(), }) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/breakfast.module.css b/packages/booking-flow/lib/components/EnterDetails/Breakfast/breakfast.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/breakfast.module.css rename to packages/booking-flow/lib/components/EnterDetails/Breakfast/breakfast.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Breakfast/index.tsx similarity index 92% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Breakfast/index.tsx index 81eb49141..88c7b70ff 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Breakfast/index.tsx @@ -12,17 +12,13 @@ import BreakfastBuffetIcon from "@scandic-hotels/design-system/Icons/BreakfastBu import NoBreakfastBuffetIcon from "@scandic-hotels/design-system/Icons/NoBreakfastBuffetIcon" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" -import { useEnterDetailsStore } from "@/stores/enter-details" - -import { useRoomContext } from "@/contexts/Details/Room" -import { trackBreakfastSelection } from "@/utils/tracking" - -import { breakfastFormSchema } from "./schema" +import { useRoomContext } from "../../../contexts/EnterDetails/RoomContext" +import { useEnterDetailsStore } from "../../../stores/enter-details" +import { useTrackingContext } from "../../../trackingContext" +import { type BreakfastFormSchema, breakfastFormSchema } from "./schema" import styles from "./breakfast.module.css" -import type { BreakfastFormSchema } from "@/types/components/hotelReservation/breakfast" - export default function Breakfast() { const intl = useIntl() const packages = useEnterDetailsStore((state) => state.breakfastPackages) @@ -32,6 +28,8 @@ export default function Breakfast() { room, } = useRoomContext() + const { trackBreakfastSelection } = useTrackingContext() + const hasChildrenInRoom = !!room.childrenInRoom?.length const totalPriceForNoBreakfast = 0 @@ -57,12 +55,14 @@ export default function Breakfast() { } else { updateBreakfast(false) } + trackBreakfastSelection({ breakfastPackage: pkg ?? packages[0], hotelId, units: pkg ? room.adults : 0, }) }, + // eslint-disable-next-line react-hooks/exhaustive-deps [packages, hotelId, room.adults, updateBreakfast] ) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/schema.ts b/packages/booking-flow/lib/components/EnterDetails/Breakfast/schema.ts similarity index 63% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/schema.ts rename to packages/booking-flow/lib/components/EnterDetails/Breakfast/schema.ts index d8008d2c6..556c83a0f 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/schema.ts +++ b/packages/booking-flow/lib/components/EnterDetails/Breakfast/schema.ts @@ -1,5 +1,6 @@ import { z } from "zod" +export type BreakfastFormSchema = z.infer export const breakfastFormSchema = z.object({ breakfast: z.string().or(z.literal("false")), }) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css b/packages/booking-flow/lib/components/EnterDetails/Confirm/Guarantee/guarantee.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/guarantee.module.css rename to packages/booking-flow/lib/components/EnterDetails/Confirm/Guarantee/guarantee.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Confirm/Guarantee/index.tsx similarity index 92% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Confirm/Guarantee/index.tsx index 41eeca363..42b6e7929 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Confirm/Guarantee/index.tsx @@ -19,7 +19,7 @@ import { SelectPaymentMethod } from "@scandic-hotels/design-system/Form/SelectPa import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { trackUpdatePaymentMethod } from "@/utils/tracking" +import { useTrackingContext } from "../../../../trackingContext" import styles from "./guarantee.module.css" @@ -32,6 +32,8 @@ interface GuaranteeProps { export default function Guarantee({ savedCreditCards }: GuaranteeProps) { const intl = useIntl() const guarantee = useWatch({ name: "guarantee" }) + const { trackUpdatePaymentMethod } = useTrackingContext() + return (

    @@ -106,18 +108,19 @@ export default function Guarantee({ savedCreditCards }: GuaranteeProps) { {savedCreditCards?.length && guarantee ? ( trackUpdatePaymentMethod({ method })} - paymentMethods={savedCreditCards.map((x) => ({ - ...x, - cardType: x.cardType as PaymentMethodEnum, + paymentMethods={savedCreditCards.map((card) => ({ + ...card, + cardType: card.cardType as PaymentMethodEnum, }))} + onChange={(method) => { + trackUpdatePaymentMethod({ method }) + }} + formName={"paymentMethod"} /> ) : null} {guarantee ? ( trackUpdatePaymentMethod({ method })} label={ savedCreditCards?.length ? intl.formatMessage({ diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css b/packages/booking-flow/lib/components/EnterDetails/Confirm/confirm.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/confirm.module.css rename to packages/booking-flow/lib/components/EnterDetails/Confirm/confirm.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Confirm/index.tsx similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Confirm/index.tsx diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Details/MemberPriceModal/index.tsx similarity index 97% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Details/MemberPriceModal/index.tsx index 00bb86e8e..da1d8881e 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Details/MemberPriceModal/index.tsx @@ -13,7 +13,7 @@ import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton import Subtitle from "@scandic-hotels/design-system/Subtitle" import Title from "@scandic-hotels/design-system/Title" -import { useRoomContext } from "@/contexts/Details/Room" +import { useRoomContext } from "../../../../contexts/EnterDetails/RoomContext" import styles from "./modal.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/modal.module.css b/packages/booking-flow/lib/components/EnterDetails/Details/MemberPriceModal/modal.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/modal.module.css rename to packages/booking-flow/lib/components/EnterDetails/Details/MemberPriceModal/modal.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx similarity index 90% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx index 5832e378b..3a14e667e 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx @@ -3,21 +3,21 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { membershipTermsAndConditions } from "@scandic-hotels/common/constants/routes/membershipTermsAndConditions" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Footnote from "@scandic-hotels/design-system/Footnote" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" import Link from "@scandic-hotels/design-system/Link" import { Typography } from "@scandic-hotels/design-system/Typography" -import { membershipTermsAndConditions } from "@/constants/webHrefs" - -import { useRoomContext } from "@/contexts/Details/Room" -import useLang from "@/hooks/useLang" +import { useRoomContext } from "../../../../../contexts/EnterDetails/RoomContext" +import useLang from "../../../../../hooks/useLang" import styles from "./joinScandicFriendsCard.module.css" -import type { JoinScandicFriendsCardProps } from "@/types/components/hotelReservation/enterDetails/details" - +export type JoinScandicFriendsCardProps = { + name?: string +} export default function JoinScandicFriendsCard({ name = "join", }: JoinScandicFriendsCardProps) { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/joinScandicFriendsCard.module.css b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/joinScandicFriendsCard.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/joinScandicFriendsCard.module.css rename to packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/joinScandicFriendsCard.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/details.module.css b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/details.module.css similarity index 100% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/details.module.css rename to packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/details.module.css diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/index.tsx similarity index 90% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/index.tsx index 58a0e5023..e9aacb2ab 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Details/Multiroom/index.tsx @@ -1,26 +1,25 @@ "use client" + import { zodResolver } from "@hookform/resolvers/zod" import { useCallback, useEffect, useMemo } from "react" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" -import { useFormTracking } from "@scandic-hotels/common/tracking/useFormTracking" +import { usePhoneNumberParsing } from "@scandic-hotels/common/hooks/usePhoneNumberParsing" import { getDefaultCountryFromLang } from "@scandic-hotels/common/utils/phone" import Footnote from "@scandic-hotels/design-system/Footnote" import CountrySelect from "@scandic-hotels/design-system/Form/Country" import Phone from "@scandic-hotels/design-system/Form/Phone" +import { useFormTracking } from "@scandic-hotels/tracking/useFormTracking" -import { useEnterDetailsStore } from "@/stores/enter-details" - -import SpecialRequests from "@/components/HotelReservation/EnterDetails/Details/SpecialRequests" -import Input from "@/components/TempDesignSystem/Form/Input" -import { useRoomContext } from "@/contexts/Details/Room" -import useLang from "@/hooks/useLang" -import usePhoneNumberParsing from "@/hooks/usePhoneNumberParsing" -import { getFormattedCountryList } from "@/utils/countries" -import { getErrorMessage } from "@/utils/getErrorMessage" - +import { useRoomContext } from "../../../../contexts/EnterDetails/RoomContext" +import useLang from "../../../../hooks/useLang" +import { getFormattedCountryList } from "../../../../misc/getFormatedCountryList" +import { useEnterDetailsStore } from "../../../../stores/enter-details" +import BookingFlowInput from "../../../BookingFlowInput" +import { getErrorMessage } from "../../../BookingFlowInput/errors" import MemberPriceModal from "../MemberPriceModal" +import { SpecialRequests } from "../SpecialRequests" import JoinScandicFriendsCard from "./JoinScandicFriendsCard" import { getMultiroomDetailsSchema } from "./schema" @@ -179,7 +178,7 @@ export default function Details() { defaultMessage: "Guest information", })} - - - {guestIsGoingToJoin ? null : ( - stringMatcher.test(key) -export const multiroomErrors = { - COUNTRY_REQUIRED: "COUNTRY_REQUIRED", - FIRST_NAME_REQUIRED: "FIRST_NAME_REQUIRED", - FIRST_NAME_SPECIAL_CHARACTERS: "FIRST_NAME_SPECIAL_CHARACTERS", - FIRST_AND_LAST_NAME_UNIQUE: "FIRST_AND_LAST_NAME_UNIQUE", - LAST_NAME_REQUIRED: "LAST_NAME_REQUIRED", - LAST_NAME_SPECIAL_CHARACTERS: "LAST_NAME_SPECIAL_CHARACTERS", - PHONE_REQUIRED: "PHONE_REQUIRED", - PHONE_REQUESTED: "PHONE_REQUESTED", - EMAIL_REQUIRED: "EMAIL_REQUIRED", - MEMBERSHIP_NO_ONLY_DIGITS: "MEMBERSHIP_NO_ONLY_DIGITS", - MEMBERSHIP_NO_INVALID: "MEMBERSHIP_NO_INVALID", - MEMBERSHIP_NO_UNIQUE: "MEMBERSHIP_NO_UNIQUE", -} as const - export type CrossValidationData = { firstName: string | undefined lastName: string | undefined membershipNo: string | undefined } - +export type MultiroomDetailsSchema = z.output< + ReturnType +> export function getMultiroomDetailsSchema( crossValidationData: CrossValidationData[] | undefined = [] ) { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx b/packages/booking-flow/lib/components/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx similarity index 84% rename from apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx rename to packages/booking-flow/lib/components/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx index cbe403781..a4b824a26 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx +++ b/packages/booking-flow/lib/components/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx @@ -2,6 +2,8 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { membershipTermsAndConditions } from "@scandic-hotels/common/constants/routes/membershipTermsAndConditions" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Footnote from "@scandic-hotels/design-system/Footnote" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" @@ -10,23 +12,20 @@ import { LoginButton } from "@scandic-hotels/design-system/LoginButton" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import { Typography } from "@scandic-hotels/design-system/Typography" -import { membershipTermsAndConditions } from "@/constants/webHrefs" - -import { useRoomContext } from "@/contexts/Details/Room" -import useLang from "@/hooks/useLang" -import { useLazyPathname } from "@/hooks/useLazyPathname" -import { trackLoginClick } from "@/utils/tracking" +import { useRoomContext } from "../../../../../contexts/EnterDetails/RoomContext" +import useLang from "../../../../../hooks/useLang" +import { useTrackingContext } from "../../../../../trackingContext" import styles from "./joinScandicFriendsCard.module.css" -import type { JoinScandicFriendsCardProps } from "@/types/components/hotelReservation/enterDetails/details" - -export default function JoinScandicFriendsCard({ - name = "join", -}: JoinScandicFriendsCardProps) { +type Props = { + name?: string +} +export default function JoinScandicFriendsCard({ name = "join" }: Props) { const lang = useLang() const intl = useIntl() const loginPathname = useLazyPathname({ includeSearchParams: true }) + const { trackLoginClick } = useTrackingContext() const { room, actions: { updateJoin }, @@ -75,14 +74,14 @@ export default function JoinScandicFriendsCard({