From 800dc5c3c1db846d5cd8b8fce23dc8db5e3696d2 Mon Sep 17 00:00:00 2001 From: Anton Gunnarsson Date: Tue, 12 Aug 2025 12:36:31 +0000 Subject: [PATCH] Merged in feat/sw-3225-move-parking-information-to-booking-flow (pull request #2614) feat(SW-3225): Move ParkingInformation to design-system * Inline ParkingInformation types to remove trpc dependency * Move ParkingInformation to design-system * Move numberFormatting to common package * Add deps to external * Fix imports and i18n script * Add common as dependency * Merge branch 'master' into feat/sw-3225-move-parking-information-to-booking-flow Approved-by: Linus Flood --- .../HotelListingItem/index.tsx | 2 +- .../HotelListing/HotelListingItem/index.tsx | 2 +- .../CityMap/HotelListItem/index.tsx | 2 +- .../HotelListing/HotelListingItem/index.tsx | 2 +- .../HotelPage/IntroSection/index.tsx | 2 +- .../HotelSubpage/ParkingSubpage/index.tsx | 2 +- .../Receipt/Room/Breakfast/index.tsx | 3 +- .../Receipt/Room/index.tsx | 2 +- .../Rooms/LinkedReservation/index.tsx | 2 +- .../BookingConfirmation/utils.ts | 3 +- .../EnterDetails/Breakfast/index.tsx | 2 +- .../Details/MemberPriceModal/index.tsx | 2 +- .../JoinScandicFriendsCard/index.tsx | 2 +- .../RoomOne/JoinScandicFriendsCard/index.tsx | 2 +- .../MixedRatePaymentBreakdown/index.tsx | 3 +- .../PriceChangeSummary/index.tsx | 2 +- .../EnterDetails/PriceChangeDialog/index.tsx | 3 +- .../Summary/Mobile/BottomSheet/index.tsx | 2 +- .../Summary/UI/Room/Breakfast/index.tsx | 3 +- .../EnterDetails/Summary/UI/Room/index.tsx | 2 +- .../EnterDetails/Summary/UI/index.tsx | 2 +- .../HotelReservation/HotelCard/index.tsx | 2 +- .../PriceDetails/PriceSummary/index.tsx | 3 +- .../PriceDetails/index.tsx | 3 +- .../AddAncillaryFlowModal/index.tsx | 2 +- .../Ancillaries/AddedAncillaries/index.tsx | 3 +- .../MyStay/PriceType/Cheques.tsx | 3 +- .../MyStay/PriceType/Points.tsx | 3 +- .../MyStay/PriceType/Vouchers.tsx | 3 +- .../Steps/CancelStayPriceContainer.tsx | 2 +- .../Actions/ChangeDates/Steps/index.tsx | 2 +- .../GuaranteeLateArrival/Form/index.tsx | 2 +- .../MyStay/Rooms/MultiRoom/Room.tsx | 2 +- .../Rooms/SingleRoom/Details/Breakfast.tsx | 4 +-- .../PriceDetailsTable/Breakfast.tsx | 2 +- .../PriceDetailsTable/Row/Large.tsx | 3 +- .../PriceDetailsTable/Row/Price/BedType.tsx | 2 +- .../Row/Price/CorporateCheque.tsx | 3 +- .../PriceDetailsTable/Row/Price/Packages.tsx | 3 +- .../Row/Price/Redemption.tsx | 3 +- .../PriceDetailsTable/Row/Price/Regular.tsx | 2 +- .../PriceDetailsTable/Row/Price/Voucher.tsx | 2 +- .../PriceDetailsTable/Row/Vat.tsx | 2 +- .../SelectRate/HotelInfoCard/index.tsx | 2 +- .../MobileSummary/Content/index.tsx | 2 +- .../RateSummary/MobileSummary/Room/index.tsx | 2 +- .../RateSummary/MobileSummary/Summary.tsx | 2 +- .../RateSummary/MobileSummary/index.tsx | 3 +- .../RoomsContainer/RateSummary/index.tsx | 2 +- .../Form/Checkboxes/PetRoomMessage/index.tsx | 2 +- .../HotelReservation/SignupPromo/Desktop.tsx | 3 +- .../HotelListingMapContent/HotelPin/index.tsx | 2 +- .../ParkingInformation/ParkingPrices/utils.ts | 26 -------------- .../Accordions/Parking.tsx | 2 +- .../SidePeeks/BookedRoomSidePeek/index.tsx | 2 +- .../TempDesignSystem/AncillaryCard/index.tsx | 2 +- .../providers/BookingConfirmationProvider.tsx | 2 +- apps/scandic-web/stores/my-stay/helpers.ts | 2 +- .../hotelPage/sidepeek/amenities.ts | 1 + .../components/hotelPage/sidepeek/parking.ts | 25 +------------ package.json | 2 +- packages/common/package.json | 1 + .../common}/utils/numberFormatting.ts | 0 .../ParkingInformation/ParkingList/index.tsx | 31 ++++++++++------ .../ParkingList/parkingList.module.css | 2 +- .../ParkingPrices/index.tsx | 35 ++++++++++--------- .../ParkingPrices/parkingPrices.module.css | 0 .../ParkingInformation/ParkingPrices/utils.ts | 26 ++++++++++++++ .../components/ParkingInformation/index.tsx | 33 +++++++++-------- .../parkingInformation.module.css | 0 .../parkingInformationTypes.ts | 35 +++++++++++++++++++ packages/design-system/package.json | 5 +++ packages/design-system/vite.config.ts | 2 ++ yarn.lock | 2 ++ 74 files changed, 188 insertions(+), 171 deletions(-) delete mode 100644 apps/scandic-web/components/ParkingInformation/ParkingPrices/utils.ts rename {apps/scandic-web => packages/common}/utils/numberFormatting.ts (100%) rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/ParkingList/index.tsx (65%) rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/ParkingList/parkingList.module.css (78%) rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/ParkingPrices/index.tsx (65%) rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/ParkingPrices/parkingPrices.module.css (100%) create mode 100644 packages/design-system/lib/components/ParkingInformation/ParkingPrices/utils.ts rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/index.tsx (73%) rename {apps/scandic-web => packages/design-system/lib}/components/ParkingInformation/parkingInformation.module.css (100%) create mode 100644 packages/design-system/lib/components/ParkingInformation/parkingInformationTypes.ts diff --git a/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx b/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx index 4d07b513d..bc595c53e 100644 --- a/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx +++ b/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx @@ -1,5 +1,6 @@ import { useIntl } from "react-intl" +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon" @@ -9,7 +10,6 @@ import { Typography } from "@scandic-hotels/design-system/Typography" import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { getSingleDecimal } from "@/utils/numberFormatting" import styles from "./hotelListingItem.module.css" diff --git a/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/index.tsx b/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/index.tsx index a28b1648a..7f6152727 100644 --- a/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/index.tsx +++ b/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/index.tsx @@ -1,3 +1,4 @@ +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon" @@ -5,7 +6,6 @@ import { Typography } from "@scandic-hotels/design-system/Typography" import Image from "@/components/Image" import { getIntl } from "@/i18n" -import { getSingleDecimal } from "@/utils/numberFormatting" import styles from "./hotelListingItem.module.css" diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx index b7dcdc5f1..bad3e1d67 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx @@ -4,6 +4,7 @@ import { useCallback, useEffect, useRef } from "react" import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon" @@ -15,7 +16,6 @@ import { useDestinationPageHotelsMapStore } from "@/stores/destination-page-hote import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { getSingleDecimal } from "@/utils/numberFormatting" import styles from "./hotelListItem.module.css" diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx index d2ed24dde..26d0182d5 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx @@ -5,6 +5,7 @@ import { useParams } from "next/navigation" import { useEffect, useState } from "react" import { useIntl } from "react-intl" +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon" @@ -17,7 +18,6 @@ import { useDestinationPageHotelsMapStore } from "@/stores/destination-page-hote import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { getSingleDecimal } from "@/utils/numberFormatting" import styles from "./hotelListingItem.module.css" diff --git a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/index.tsx index 48141da25..b43af5f88 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/index.tsx @@ -1,9 +1,9 @@ +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { getIntl } from "@/i18n" -import { getSingleDecimal } from "@/utils/numberFormatting" import TripAdvisorLink from "./TripAdvisorLink" diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx index d2bdb4cbc..bad16af4c 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx @@ -1,7 +1,7 @@ import { Divider } from "@scandic-hotels/design-system/Divider" +import ParkingInformation from "@scandic-hotels/design-system/ParkingInformation" import { Typography } from "@scandic-hotels/design-system/Typography" -import ParkingInformation from "@/components/ParkingInformation" import { getIntl } from "@/i18n" import HeroHeader from "../HeroHeader" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/Breakfast/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/Breakfast/index.tsx index 15ae79126..fde998acd 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/Breakfast/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/Breakfast/index.tsx @@ -1,10 +1,9 @@ "use client" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - import styles from "./breakfast.module.css" import type { PackageSchema } from "@scandic-hotels/trpc/types/bookingConfirmation" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx index 16b2bad9d..41a2c839e 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx @@ -3,6 +3,7 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -14,7 +15,6 @@ import { useBookingConfirmationStore } from "@/stores/booking-confirmation" import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import Modal from "@/components/Modal" -import { formatPrice } from "@/utils/numberFormatting" import Breakfast from "./Breakfast" import RoomSkeletonLoader from "./RoomSkeletonLoader" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx index d45088a4f..d13a90673 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx @@ -4,12 +4,12 @@ import { useEffect } from "react" import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { trpc } from "@scandic-hotels/trpc/client" import { useBookingConfirmationStore } from "@/stores/booking-confirmation" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { mapRoomState } from "../../utils" import Room from "../Room" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts index 941357511..9af493cc2 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts @@ -1,10 +1,9 @@ import { type IntlShape } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" -import { formatPrice } from "@/utils/numberFormatting" - import type { BookingConfirmationSchema, PackageSchema, diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx index 5022b1aa5..81eb49141 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx @@ -5,6 +5,7 @@ import { useCallback, useEffect } from "react" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import RadioCard from "@scandic-hotels/design-system/Form/RadioCard" import BreakfastBuffetIcon from "@scandic-hotels/design-system/Icons/BreakfastBuffetIcon" @@ -14,7 +15,6 @@ import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import { useEnterDetailsStore } from "@/stores/enter-details" import { useRoomContext } from "@/contexts/Details/Room" -import { formatPrice } from "@/utils/numberFormatting" import { trackBreakfastSelection } from "@/utils/tracking" import { breakfastFormSchema } from "./schema" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx index 42549b6e0..238a3da21 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx @@ -5,6 +5,7 @@ import { useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import MagicWandIcon from "@scandic-hotels/design-system/Icons/MagicWandIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" @@ -13,7 +14,6 @@ import Title from "@scandic-hotels/design-system/Title" import Modal from "@/components/Modal" import { useRoomContext } from "@/contexts/Details/Room" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./modal.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx index 5e0fbd3aa..5832e378b 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx @@ -3,6 +3,7 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +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" @@ -12,7 +13,6 @@ import { membershipTermsAndConditions } from "@/constants/webHrefs" import { useRoomContext } from "@/contexts/Details/Room" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./joinScandicFriendsCard.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx index cb1278414..e97615333 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +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" @@ -13,7 +14,6 @@ import { membershipTermsAndConditions } from "@/constants/webHrefs" import LoginButton from "@/components/LoginButton" import { useRoomContext } from "@/contexts/Details/Room" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./joinScandicFriendsCard.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/MixedRatePaymentBreakdown/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/MixedRatePaymentBreakdown/index.tsx index df36e787a..cc8ada62f 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/MixedRatePaymentBreakdown/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/MixedRatePaymentBreakdown/index.tsx @@ -1,11 +1,10 @@ import React from "react" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import Caption from "@scandic-hotels/design-system/Caption" -import { formatPrice } from "@/utils/numberFormatting" - import { calculateTotalRoomPrice, hasFlexibleRate, diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx index ae35b8601..be9a0e84d 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/PriceChangeSummary/index.tsx @@ -9,6 +9,7 @@ import { } from "react-aria-components" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import Caption from "@scandic-hotels/design-system/Caption" import { Divider } from "@scandic-hotels/design-system/Divider" @@ -17,7 +18,6 @@ import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton import Subtitle from "@scandic-hotels/design-system/Subtitle" import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./priceChangeSummary.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/index.tsx index 6e05a6954..1261c0cac 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/PriceChangeDialog/index.tsx @@ -1,6 +1,7 @@ import { Dialog, Modal, ModalOverlay } from "react-aria-components" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import Caption from "@scandic-hotels/design-system/Caption" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -10,8 +11,6 @@ import Title from "@scandic-hotels/design-system/Title" import { useEnterDetailsStore } from "@/stores/enter-details" -import { formatPrice } from "@/utils/numberFormatting" - import { calculateTotalRoomPrice } from "../Payment/helpers" import PriceChangeSummary from "./PriceChangeSummary" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/Mobile/BottomSheet/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/Mobile/BottomSheet/index.tsx index 17515d4f3..20e5712b2 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/Mobile/BottomSheet/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/Mobile/BottomSheet/index.tsx @@ -6,6 +6,7 @@ import { type PropsWithChildren, useEffect, useRef } from "react" import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" @@ -14,7 +15,6 @@ import { useEnterDetailsStore } from "@/stores/enter-details" import { formId } from "@/components/HotelReservation/EnterDetails/Payment/PaymentClient" import { isBookingCodeRate } from "@/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./bottomSheet.module.css" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/Breakfast/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/Breakfast/index.tsx index 68f6f853a..b6106495d 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/Breakfast/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/Breakfast/index.tsx @@ -1,10 +1,9 @@ "use client" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - import styles from "./breakfast.module.css" import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx index a6da7cb87..bd2e46bc5 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx @@ -1,6 +1,7 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -9,7 +10,6 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" import Modal from "@/components/Modal" -import { formatPrice } from "@/utils/numberFormatting" import { getMemberPrice, getPublicPrice } from "../utils" import Breakfast from "./Breakfast" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx index fe09e4f17..d4850dcc9 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx @@ -7,6 +7,7 @@ import { useMediaQuery } from "usehooks-ts" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -18,7 +19,6 @@ import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" import { isBookingCodeRate } from "@/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils" import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { mapToPrice } from "./mapToPrice" import Room from "./Room" diff --git a/apps/scandic-web/components/HotelReservation/HotelCard/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCard/index.tsx index 0bacd8518..98b998c8c 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCard/index.tsx @@ -16,6 +16,7 @@ import { selectHotelMap, selectRate, } from "@scandic-hotels/common/constants/routes/hotelReservation" +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import Caption from "@scandic-hotels/design-system/Caption" import { Divider } from "@scandic-hotels/design-system/Divider" import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon" @@ -28,7 +29,6 @@ import BookingCodeChip from "@/components/BookingCodeChip" import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { getSingleDecimal } from "@/utils/numberFormatting" import ReadMore from "../ReadMore" import HotelChequeCard from "./HotelChequeCard" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/PriceSummary/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/PriceSummary/index.tsx index b30afe3e4..c8b70f8ab 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/PriceSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/PriceSummary/index.tsx @@ -1,11 +1,10 @@ import { Fragment } from "react" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - import PriceRow from "./PriceRow" import styles from "./priceSummary.module.css" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/index.tsx index a32983f23..a7438d2c9 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/PriceDetails/index.tsx @@ -1,6 +1,7 @@ import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" @@ -10,8 +11,6 @@ import { useAddAncillaryStore, } from "@/stores/my-stay/add-ancillary-flow" -import { formatPrice } from "@/utils/numberFormatting" - import PriceSummary from "./PriceSummary" import styles from "./priceDetails.module.css" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx index 6566a71d3..1a758c6d1 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx @@ -9,6 +9,7 @@ import { useIntl } from "react-intl" import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" @@ -33,7 +34,6 @@ import Modal from "@/components/Modal" import { toast } from "@/components/TempDesignSystem/Toasts" import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { trackAncillaryFailed, trackAncillarySuccess, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx index d8230ae9a..0842b2d68 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx @@ -1,6 +1,7 @@ import { Fragment } from "react" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Accordion from "@scandic-hotels/design-system/Accordion" import AccordionItem from "@scandic-hotels/design-system/Accordion/AccordionItem" import Body from "@scandic-hotels/design-system/Body" @@ -9,8 +10,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Subtitle from "@scandic-hotels/design-system/Subtitle" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" -import { formatPrice } from "@/utils/numberFormatting" - import { getBreakfastPackagesFromAncillaryFlow } from "../../utils/hasBreakfastPackage" import RemoveButton from "./RemoveButton" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx index 03710513f..e33850203 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx @@ -2,11 +2,10 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - export default function Cheques({ cheques, currencyCode, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx index dcc003669..d156e63de 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx @@ -2,11 +2,10 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - export default function Points({ isCancelled, points, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx index 447499c3b..bcb6e856b 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx @@ -1,11 +1,10 @@ "use client" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" export default function Vouchers({ diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx index 7f18316d0..0e56333b3 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx @@ -3,11 +3,11 @@ import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { useMyStayStore } from "@/stores/my-stay" import PriceContainer from "@/components/HotelReservation/MyStay/ReferenceCard/PriceContainer" -import { formatPrice } from "@/utils/numberFormatting" import type { CancelStayFormValues } from "@/types/components/hotelReservation/myStay/cancelStay" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx index eb2b5564c..fedc997ab 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx @@ -4,6 +4,7 @@ import { useState } from "react" import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { trpc } from "@scandic-hotels/trpc/client" import { useMyStayStore } from "@/stores/my-stay" @@ -11,7 +12,6 @@ import { useMyStayStore } from "@/stores/my-stay" import { sumPackages } from "@/components/HotelReservation/utils" import useLang from "@/hooks/useLang" import { isValidClientSession } from "@/utils/clientSession" -import { formatPrice } from "@/utils/numberFormatting" import Confirmation from "./Confirmation" import Form from "./Form" 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 c6022d598..742f6ce64 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 @@ -5,6 +5,7 @@ import { useIntl } from "react-intl" import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { guaranteeCallback } from "@scandic-hotels/common/constants/routes/hotelReservation" +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" import Link from "@scandic-hotels/design-system/Link" @@ -22,7 +23,6 @@ import LoadingSpinner from "@/components/LoadingSpinner" import { toast } from "@/components/TempDesignSystem/Toasts" import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { trackGlaSaveCardAttempt } from "@/utils/tracking/myStay" import { type GuaranteeFormData, paymentSchema } from "./schema" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx index 29680404a..3d85fc441 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx @@ -3,6 +3,7 @@ import { useIntl } from "react-intl" import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import { IconButton } from "@scandic-hotels/design-system/IconButton" import IconChip from "@scandic-hotels/design-system/IconChip" @@ -18,7 +19,6 @@ import Image from "@/components/Image" import Modal from "@/components/Modal" import useRateTitles from "@/hooks/booking/useRateTitles" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import PriceType from "../../PriceType" import { hasModifiableRate } from "../../utils" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Breakfast.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Breakfast.tsx index 3e05fcb42..425ab68be 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Breakfast.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Breakfast.tsx @@ -1,9 +1,9 @@ "use client" import { useIntl } from "react-intl" -import { useMyStayStore } from "@/stores/my-stay" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" -import { formatPrice } from "@/utils/numberFormatting" +import { useMyStayStore } from "@/stores/my-stay" import Row from "./Row" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Breakfast.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Breakfast.tsx index f3c02d08a..b9af7df45 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Breakfast.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Breakfast.tsx @@ -1,7 +1,7 @@ "use client" import { useIntl } from "react-intl" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import BoldRow from "./Row/Bold" import RegularRow from "./Row/Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Large.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Large.tsx index f798c740f..a99a2be1b 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Large.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Large.tsx @@ -2,10 +2,9 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Typography } from "@scandic-hotels/design-system/Typography" -import { formatPrice } from "@/utils/numberFormatting" - import styles from "./row.module.css" import type { Price } from "@/types/components/hotelReservation/price" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/BedType.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/BedType.tsx index dd9595082..7e6230e40 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/BedType.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/BedType.tsx @@ -1,7 +1,7 @@ "use client" import { useIntl } from "react-intl" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx index 7c0e0403f..35c78577a 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx @@ -2,8 +2,7 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" - -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx index d640f15c3..d962ff2fa 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Packages.tsx @@ -1,8 +1,9 @@ "use client" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" + import { getFeatureDescription } from "@/components/HotelReservation/utils/getRoomFeatureDescription" -import { formatPrice } from "@/utils/numberFormatting" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx index 476984dc3..9604dbe12 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx @@ -2,8 +2,7 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" - -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx index 2a78c3d64..73d42eeab 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx @@ -1,7 +1,7 @@ "use client" import { useIntl } from "react-intl" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx index 356779ae1..4e49fd596 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx @@ -1,7 +1,7 @@ "use client" import { useIntl } from "react-intl" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import BoldRow from "../Bold" import RegularRow from "../Regular" diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx index 096bd2b27..7eb556400 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx @@ -2,9 +2,9 @@ import { useIntl } from "react-intl" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { calculateVat } from "@/components/HotelReservation/utils" -import { formatPrice } from "@/utils/numberFormatting" import RegularRow from "./Regular" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx index 2ee4465aa..d20052098 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx @@ -1,4 +1,5 @@ import TripAdvisorChip from "@scandic-hotels/booking-flow/components/TripAdvisorChip" +import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer" import { Typography } from "@scandic-hotels/design-system/Typography" @@ -8,7 +9,6 @@ import ImageGallery from "@/components/ImageGallery" import Alert from "@/components/TempDesignSystem/Alert" import { getIntl } from "@/i18n" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { getSingleDecimal } from "@/utils/numberFormatting" import ReadMore from "../../ReadMore" import { getHotelAlertsForBookingDates } from "../../utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx index c21c96946..785f84aa8 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx @@ -4,6 +4,7 @@ import { useIntl } from "react-intl" import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import { IconButton } from "@scandic-hotels/design-system/IconButton" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -14,7 +15,6 @@ import { useRatesStore } from "@/stores/select-rate" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { mapToPrice } from "../mapToPrice" import Room from "../Room" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx index bad97fe03..df3000bd9 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx @@ -1,6 +1,7 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" @@ -10,7 +11,6 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import { getRoomPrice } from "@/stores/enter-details/helpers" import Modal from "@/components/Modal" -import { formatPrice } from "@/utils/numberFormatting" import { getMemberPrice, isBookingCodeRate } from "../utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx index f0d76c173..ed9701d0f 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx @@ -5,6 +5,7 @@ import { useIntl } from "react-intl" import { longDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import { Button } from "@scandic-hotels/design-system/Button" import Caption from "@scandic-hotels/design-system/Caption" @@ -19,7 +20,6 @@ import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" import Modal from "@/components/Modal" import useLang from "@/hooks/useLang" -import { formatPrice } from "@/utils/numberFormatting" import { mapToPrice } from "./mapToPrice" import { isBookingCodeRate } from "./utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx index 98123bcc7..4bfc3b243 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx @@ -4,14 +4,13 @@ import { useEffect, useRef, useState } from "react" import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { useRatesStore } from "@/stores/select-rate" -import { formatPrice } from "@/utils/numberFormatting" - import SummaryContent from "./Content" import { mapRate } from "./mapRate" import { isBookingCodeRate } from "./utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx index cd639b134..71416f35c 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx @@ -5,6 +5,7 @@ import { useState, useTransition } from "react" import { useIntl } from "react-intl" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import Caption from "@scandic-hotels/design-system/Caption" import Footnote from "@scandic-hotels/design-system/Footnote" @@ -17,7 +18,6 @@ import { useRatesStore } from "@/stores/select-rate" import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" import { isValidClientSession } from "@/utils/clientSession" -import { formatPrice } from "@/utils/numberFormatting" import MobileSummary from "./MobileSummary" import { getTotalPrice } from "./utils" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/PetRoomMessage/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/PetRoomMessage/index.tsx index 19ec9cce2..f2b777c5d 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/PetRoomMessage/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/PetRoomMessage/index.tsx @@ -1,10 +1,10 @@ "use client" import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Typography } from "@scandic-hotels/design-system/Typography" import { useRoomContext } from "@/contexts/SelectRate/Room" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./petRoom.module.css" diff --git a/apps/scandic-web/components/HotelReservation/SignupPromo/Desktop.tsx b/apps/scandic-web/components/HotelReservation/SignupPromo/Desktop.tsx index 42671831f..0d5f9ea36 100644 --- a/apps/scandic-web/components/HotelReservation/SignupPromo/Desktop.tsx +++ b/apps/scandic-web/components/HotelReservation/SignupPromo/Desktop.tsx @@ -2,11 +2,10 @@ import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Caption from "@scandic-hotels/design-system/Caption" import Footnote from "@scandic-hotels/design-system/Footnote" -import { formatPrice } from "@/utils/numberFormatting" - import styles from "./signupPromo.module.css" import type { SignupPromoProps } from "@/types/components/hotelReservation/signupPromo" diff --git a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx index 476327582..205bbd66b 100644 --- a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx +++ b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx @@ -1,10 +1,10 @@ import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import HotelMarker from "@/components/Maps/Markers/HotelMarker" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./hotelPin.module.css" diff --git a/apps/scandic-web/components/ParkingInformation/ParkingPrices/utils.ts b/apps/scandic-web/components/ParkingInformation/ParkingPrices/utils.ts deleted file mode 100644 index db3e76be0..000000000 --- a/apps/scandic-web/components/ParkingInformation/ParkingPrices/utils.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { IntlShape } from "react-intl" - -import { Periods } from "@/types/components/hotelPage/sidepeek/parking" - -export function getPeriod(intl: IntlShape, period?: string) { - switch (period) { - case Periods.hour: - return intl.formatMessage({ - defaultMessage: "Price per hour", - }) - case Periods.day: - return intl.formatMessage({ - defaultMessage: "Price per day", - }) - case Periods.night: - return intl.formatMessage({ - defaultMessage: "Price per night", - }) - case Periods.allDay: - return intl.formatMessage({ - defaultMessage: "Price per 24 hours", - }) - default: - return period - } -} diff --git a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Parking.tsx b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Parking.tsx index 9e1cd6bfc..49e9c4082 100644 --- a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Parking.tsx +++ b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Parking.tsx @@ -5,9 +5,9 @@ import { useIntl } from "react-intl" import AccordionItem from "@scandic-hotels/design-system/Accordion/AccordionItem" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { IconName } from "@scandic-hotels/design-system/Icons/iconName" +import ParkingInformation from "@scandic-hotels/design-system/ParkingInformation" import { Typography } from "@scandic-hotels/design-system/Typography" -import ParkingInformation from "@/components/ParkingInformation" import { trackAccordionClick } from "@/utils/tracking" import styles from "./sidePeekAccordion.module.css" diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index 40989b6b6..e939a9502 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" import { changeOrCancelDateFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Accordion from "@scandic-hotels/design-system/Accordion" import AccordionItem from "@scandic-hotels/design-system/Accordion/AccordionItem" import IconChip from "@scandic-hotels/design-system/IconChip" @@ -19,7 +20,6 @@ import ImageGallery from "@/components/ImageGallery" import SidePeekSelfControlled from "@/components/TempDesignSystem/SidePeekSelfControlled" import useLang from "@/hooks/useLang" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" -import { formatPrice } from "@/utils/numberFormatting" import RoomDetails from "./RoomDetails" diff --git a/apps/scandic-web/components/TempDesignSystem/AncillaryCard/index.tsx b/apps/scandic-web/components/TempDesignSystem/AncillaryCard/index.tsx index 0801b6b02..5424f3fbe 100644 --- a/apps/scandic-web/components/TempDesignSystem/AncillaryCard/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/AncillaryCard/index.tsx @@ -1,11 +1,11 @@ import { useIntl } from "react-intl" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import Body from "@scandic-hotels/design-system/Body" import Caption from "@scandic-hotels/design-system/Caption" import { Divider } from "@scandic-hotels/design-system/Divider" import Image from "@/components/Image" -import { formatPrice } from "@/utils/numberFormatting" import styles from "./ancillaryCard.module.css" diff --git a/apps/scandic-web/providers/BookingConfirmationProvider.tsx b/apps/scandic-web/providers/BookingConfirmationProvider.tsx index 3f56ee068..544fef2e3 100644 --- a/apps/scandic-web/providers/BookingConfirmationProvider.tsx +++ b/apps/scandic-web/providers/BookingConfirmationProvider.tsx @@ -8,7 +8,7 @@ import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { createBookingConfirmationStore } from "@/stores/booking-confirmation" import { BookingConfirmationContext } from "@/contexts/BookingConfirmation" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import type { BookingConfirmationStore } from "@/types/contexts/booking-confirmation" import type { BookingConfirmationProviderProps } from "@/types/providers/booking-confirmation" diff --git a/apps/scandic-web/stores/my-stay/helpers.ts b/apps/scandic-web/stores/my-stay/helpers.ts index fb59441fd..ba8828a60 100644 --- a/apps/scandic-web/stores/my-stay/helpers.ts +++ b/apps/scandic-web/stores/my-stay/helpers.ts @@ -1,6 +1,6 @@ import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import type { IntlShape } from "react-intl" diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts index f120b769b..e056a98c7 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts @@ -4,6 +4,7 @@ import type { Hotel, Restaurant, } from "@scandic-hotels/trpc/types/hotel" + import type { ParkingAmenityProps } from "./parking" export type AmenitiesSidePeekProps = { diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts index 17d5846bb..657eb21a9 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts @@ -1,30 +1,7 @@ -import type { Hotel, Parking } from "@scandic-hotels/trpc/types/hotel" - -export enum Periods { - allDay = "AllDay", - hour = "Hour", - day = "Day", - night = "Night", -} +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export type ParkingAmenityProps = { parkingPageUrl?: string parking: Hotel["parking"] parkingElevatorPitch?: string } - -export interface ParkingListProps - extends Pick< - Parking, - | "address" - | "canMakeReservation" - | "distanceToHotel" - | "numberOfChargingSpaces" - | "numberOfParkingSpots" - > {} - -export interface ParkingPricesProps - extends Pick, - Pick, "currency"> { - pricing: NonNullable["ordinary"] -} diff --git a/package.json b/package.json index 067473a07..1575f10de 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "check-types": "turbo run check-types", "env:web": "node scripts/show-env.mjs scandic-web --missing", "env:sas": "node scripts/show-env.mjs partner-sas --missing", - "i18n:extract": "formatjs extract \"{apps/scandic-web,apps/partner-sas,packages/booking-flow}/{actions,app,components,constants,contexts,env,hooks,i18n,lib,middlewares,netlify,providers,server,services,stores,utils}/**/*.{ts,tsx}\" --format scripts/i18n/formatter.mjs --out-file scripts/i18n/extracted.json", + "i18n:extract": "formatjs extract \"{apps/scandic-web,apps/partner-sas,packages/booking-flow,packages/design-system}/{actions,app,components,constants,contexts,env,hooks,i18n,lib,middlewares,netlify,providers,server,services,stores,utils}/**/*.{ts,tsx}\" --format scripts/i18n/formatter.mjs --out-file scripts/i18n/extracted.json", "i18n:upload": "jiti scripts/i18n/upload.ts", "i18n:download": "jiti scripts/i18n/download.ts", "i18n:compile": "formatjs compile-folder --ast --format scripts/i18n/formatter.mjs scripts/i18n/translations-all scripts/i18n/dictionaries", diff --git a/packages/common/package.json b/packages/common/package.json index 253ee6bad..494d64c79 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -26,6 +26,7 @@ "./utils/isDefined": "./utils/isDefined.ts", "./utils/maskValue": "./utils/maskValue.ts", "./utils/dateFormatting": "./utils/dateFormatting.ts", + "./utils/numberFormatting": "./utils/numberFormatting.ts", "./utils/rangeArray": "./utils/rangeArray.ts", "./utils/zod/*": "./utils/zod/*.ts", "./utils/debounce": "./utils/debounce.ts", diff --git a/apps/scandic-web/utils/numberFormatting.ts b/packages/common/utils/numberFormatting.ts similarity index 100% rename from apps/scandic-web/utils/numberFormatting.ts rename to packages/common/utils/numberFormatting.ts diff --git a/apps/scandic-web/components/ParkingInformation/ParkingList/index.tsx b/packages/design-system/lib/components/ParkingInformation/ParkingList/index.tsx similarity index 65% rename from apps/scandic-web/components/ParkingInformation/ParkingList/index.tsx rename to packages/design-system/lib/components/ParkingInformation/ParkingList/index.tsx index 4166e67ea..6789d8ca3 100644 --- a/apps/scandic-web/components/ParkingInformation/ParkingList/index.tsx +++ b/packages/design-system/lib/components/ParkingInformation/ParkingList/index.tsx @@ -1,12 +1,21 @@ -"use client" +'use client' -import { useIntl } from "react-intl" +import { useIntl } from 'react-intl' -import { Typography } from "@scandic-hotels/design-system/Typography" +import { Typography } from '../../Typography' -import styles from "./parkingList.module.css" +import styles from './parkingList.module.css' -import type { ParkingListProps } from "@/types/components/hotelPage/sidepeek/parking" +import type { Parking } from '../parkingInformationTypes' + +type ParkingListProps = Pick< + Parking, + | 'address' + | 'canMakeReservation' + | 'distanceToHotel' + | 'numberOfChargingSpaces' + | 'numberOfParkingSpots' +> export default function ParkingList({ numberOfChargingSpaces, @@ -18,10 +27,10 @@ export default function ParkingList({ const intl = useIntl() const canMakeReservationYesMsg = intl.formatMessage({ - defaultMessage: "Parking can be reserved in advance: Yes", + defaultMessage: 'Parking can be reserved in advance: Yes', }) const canMakeReservationNoMsg = intl.formatMessage({ - defaultMessage: "Parking can be reserved in advance: No", + defaultMessage: 'Parking can be reserved in advance: No', }) return ( @@ -32,7 +41,7 @@ export default function ParkingList({ {intl.formatMessage( { defaultMessage: - "Number of charging points for electric cars: {number}", + 'Number of charging points for electric cars: {number}', }, { number: numberOfChargingSpaces } )} @@ -47,7 +56,7 @@ export default function ParkingList({
  • {intl.formatMessage( { - defaultMessage: "Number of parking spots: {number}", + defaultMessage: 'Number of parking spots: {number}', }, { number: numberOfParkingSpots } )} @@ -57,7 +66,7 @@ export default function ParkingList({
  • {intl.formatMessage( { - defaultMessage: "Distance to hotel: {distanceInM} m", + defaultMessage: 'Distance to hotel: {distanceInM} m', }, { distanceInM: distanceToHotel } )} @@ -67,7 +76,7 @@ export default function ParkingList({
  • {intl.formatMessage( { - defaultMessage: "Address: {address}", + defaultMessage: 'Address: {address}', }, { address } )} diff --git a/apps/scandic-web/components/ParkingInformation/ParkingList/parkingList.module.css b/packages/design-system/lib/components/ParkingInformation/ParkingList/parkingList.module.css similarity index 78% rename from apps/scandic-web/components/ParkingInformation/ParkingList/parkingList.module.css rename to packages/design-system/lib/components/ParkingInformation/ParkingList/parkingList.module.css index 6e837a4fd..4a1494579 100644 --- a/apps/scandic-web/components/ParkingInformation/ParkingList/parkingList.module.css +++ b/packages/design-system/lib/components/ParkingInformation/ParkingList/parkingList.module.css @@ -3,7 +3,7 @@ } .listStyling > li::before { - content: url("/_static/icons/heart.svg"); + content: url('/_static/icons/heart.svg'); position: relative; height: 8px; top: 3px; diff --git a/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx similarity index 65% rename from apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx rename to packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx index 1124e2dde..f9be58309 100644 --- a/apps/scandic-web/components/ParkingInformation/ParkingPrices/index.tsx +++ b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/index.tsx @@ -1,22 +1,24 @@ -"use client" +'use client' -import { useIntl } from "react-intl" +import { useIntl } from 'react-intl' -import { Typography } from "@scandic-hotels/design-system/Typography" +import { Typography } from '../../Typography' -import { formatPrice } from "@/utils/numberFormatting" +import { formatPrice } from '@scandic-hotels/common/utils/numberFormatting' -import { getPeriod } from "./utils" +import { type Parking, ParkingPricePeriods } from '../parkingInformationTypes' +import { getPeriod } from './utils' -import styles from "./parkingPrices.module.css" +import styles from './parkingPrices.module.css' -import { - type ParkingPricesProps, - Periods, -} from "@/types/components/hotelPage/sidepeek/parking" +interface ParkingPricesProps + extends Pick, + Pick, 'currency'> { + pricing: NonNullable['ordinary'] +} export default function ParkingPrices({ - currency = "", + currency = '', freeParking, pricing, }: ParkingPricesProps) { @@ -26,7 +28,7 @@ export default function ParkingPrices({ return (

    - {intl.formatMessage({ defaultMessage: "Free parking" })} + {intl.formatMessage({ defaultMessage: 'Free parking' })}

    ) @@ -40,12 +42,12 @@ export default function ParkingPrices({
    -
    {getPeriod(intl, "Hour")}
    +
    {getPeriod(intl, 'Hour')}
    {intl.formatMessage({ - defaultMessage: "At a cost", + defaultMessage: 'At a cost', })}
    @@ -67,11 +69,10 @@ export default function ParkingPrices({
    {formatPrice(intl, amount, currency)}
    - {startTime && endTime && period !== Periods.allDay ? ( + {startTime && endTime && period !== ParkingPricePeriods.allDay ? (
    -
    {intl.formatMessage({ defaultMessage: "From" })}
    - {/* eslint-disable formatjs/no-literal-string-in-jsx */} +
    {intl.formatMessage({ defaultMessage: 'From' })}
    {`${startTime}-${endTime}`}
    diff --git a/apps/scandic-web/components/ParkingInformation/ParkingPrices/parkingPrices.module.css b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/parkingPrices.module.css similarity index 100% rename from apps/scandic-web/components/ParkingInformation/ParkingPrices/parkingPrices.module.css rename to packages/design-system/lib/components/ParkingInformation/ParkingPrices/parkingPrices.module.css diff --git a/packages/design-system/lib/components/ParkingInformation/ParkingPrices/utils.ts b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/utils.ts new file mode 100644 index 000000000..4c9867b21 --- /dev/null +++ b/packages/design-system/lib/components/ParkingInformation/ParkingPrices/utils.ts @@ -0,0 +1,26 @@ +import { ParkingPricePeriods } from '../parkingInformationTypes' + +import type { IntlShape } from 'react-intl' + +export function getPeriod(intl: IntlShape, period?: string) { + switch (period) { + case ParkingPricePeriods.hour: + return intl.formatMessage({ + defaultMessage: 'Price per hour', + }) + case ParkingPricePeriods.day: + return intl.formatMessage({ + defaultMessage: 'Price per day', + }) + case ParkingPricePeriods.night: + return intl.formatMessage({ + defaultMessage: 'Price per night', + }) + case ParkingPricePeriods.allDay: + return intl.formatMessage({ + defaultMessage: 'Price per 24 hours', + }) + default: + return period + } +} diff --git a/apps/scandic-web/components/ParkingInformation/index.tsx b/packages/design-system/lib/components/ParkingInformation/index.tsx similarity index 73% rename from apps/scandic-web/components/ParkingInformation/index.tsx rename to packages/design-system/lib/components/ParkingInformation/index.tsx index cbbd38bc7..74faccf84 100644 --- a/apps/scandic-web/components/ParkingInformation/index.tsx +++ b/packages/design-system/lib/components/ParkingInformation/index.tsx @@ -1,20 +1,19 @@ -"use client" +'use client' -import { useIntl } from "react-intl" +import { useIntl } from 'react-intl' -import ButtonLink from "@scandic-hotels/design-system/ButtonLink" -import { Divider } from "@scandic-hotels/design-system/Divider" -import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import { Typography } from "@scandic-hotels/design-system/Typography" +import { Divider } from '../Divider' +import { MaterialIcon } from '../Icons/MaterialIcon' +import { Typography } from '../Typography' +import ButtonLink from '../ButtonLink' +import ParkingList from './ParkingList' +import ParkingPrices from './ParkingPrices' -import ParkingList from "./ParkingList" -import ParkingPrices from "./ParkingPrices" +import styles from './parkingInformation.module.css' -import styles from "./parkingInformation.module.css" +import type { Parking } from './parkingInformationTypes' -import type { Parking } from "@scandic-hotels/trpc/types/hotel" - -interface ParkingInformationProps { +type ParkingInformationProps = { parking: Parking showExternalParkingButton?: boolean } @@ -24,7 +23,7 @@ export default function ParkingInformation({ showExternalParkingButton = true, }: ParkingInformationProps) { const intl = useIntl() - const title = `${parking.type}${parking.name ? ` (${parking.name})` : ""}` + const title = `${parking.type}${parking.name ? ` (${parking.name})` : ''}` return (
    @@ -43,13 +42,13 @@ export default function ParkingInformation({
    - {intl.formatMessage({ defaultMessage: "Prices" })} + {intl.formatMessage({ defaultMessage: 'Prices' })}
    - {intl.formatMessage({ defaultMessage: "Weekday prices" })} + {intl.formatMessage({ defaultMessage: 'Weekday prices' })}
    @@ -64,7 +63,7 @@ export default function ParkingInformation({
    - {intl.formatMessage({ defaultMessage: "Weekend prices" })} + {intl.formatMessage({ defaultMessage: 'Weekend prices' })}
    @@ -83,7 +82,7 @@ export default function ParkingInformation({ href={parking.externalParkingUrl} target="_blank" > - {intl.formatMessage({ defaultMessage: "Book parking" })} + {intl.formatMessage({ defaultMessage: 'Book parking' })} )} diff --git a/apps/scandic-web/components/ParkingInformation/parkingInformation.module.css b/packages/design-system/lib/components/ParkingInformation/parkingInformation.module.css similarity index 100% rename from apps/scandic-web/components/ParkingInformation/parkingInformation.module.css rename to packages/design-system/lib/components/ParkingInformation/parkingInformation.module.css diff --git a/packages/design-system/lib/components/ParkingInformation/parkingInformationTypes.ts b/packages/design-system/lib/components/ParkingInformation/parkingInformationTypes.ts new file mode 100644 index 000000000..f929a4b4a --- /dev/null +++ b/packages/design-system/lib/components/ParkingInformation/parkingInformationTypes.ts @@ -0,0 +1,35 @@ +type Price = { + amount: number + endTime: string + period: string + startTime: string +} + +type CurrencyPrice = { + currency: string + weekend: Price[] + ordinary: Price[] +} + +export type Parking = { + address: string + canMakeReservation: boolean + distanceToHotel: number + externalParkingUrl: string + name: string + numberOfChargingSpaces: number + numberOfParkingSpots: number + type: string + pricing: { + freeParking: boolean + paymentType: string + localCurrency?: CurrencyPrice | null + } +} + +export enum ParkingPricePeriods { + allDay = 'AllDay', + hour = 'Hour', + day = 'Day', + night = 'Night', +} diff --git a/packages/design-system/package.json b/packages/design-system/package.json index e4dba24cf..97102e54b 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -41,6 +41,7 @@ "./RegularRateCard": "./lib/components/RateCard/Regular/index.tsx", "./CampaignRateCard": "./lib/components/RateCard/Campaign/index.tsx", "./CodeRateCard": "./lib/components/RateCard/Code/index.tsx", + "./ParkingInformation": "./lib/components/ParkingInformation/index.tsx", "./PointsRateCard": "./lib/components/RateCard/Points/index.tsx", "./Preamble": "./lib/components/Preamble/index.tsx", "./NoRateAvailableCard": "./lib/components/RateCard/NoRateAvailable/index.tsx", @@ -161,6 +162,9 @@ "prepare": "husky && yarn run build", "check-types": "tsc --noEmit" }, + "dependencies": { + "@scandic-hotels/common": "workspace:*" + }, "peerDependencies": { "@internationalized/date": "^3.8.0", "@radix-ui/react-slot": "^1.2.2", @@ -170,6 +174,7 @@ "react-dom": "^19.1.0", "react-hook-form": "^7.56.2", "react-international-phone": "^4.5.0", + "react-intl": "^7", "usehooks-ts": "3.1.1" }, "devDependencies": { diff --git a/packages/design-system/vite.config.ts b/packages/design-system/vite.config.ts index ae30018a1..abc7a4305 100644 --- a/packages/design-system/vite.config.ts +++ b/packages/design-system/vite.config.ts @@ -47,6 +47,8 @@ export default defineConfig({ 'react/jsx-runtime', 'react-aria-components', 'react-hook-form', + 'react-intl', + 'next', ], onwarn(warning, defaultHandler) { if ( diff --git a/yarn.lock b/yarn.lock index 796627d11..48bb394ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6701,6 +6701,7 @@ __metadata: dependencies: "@eslint/eslintrc": "npm:^3.3.1" "@eslint/js": "npm:^9.26.0" + "@scandic-hotels/common": "workspace:*" "@storybook/addon-essentials": "npm:^8.6.12" "@storybook/addon-interactions": "npm:^8.6.12" "@storybook/addon-links": "npm:^8.6.12" @@ -6751,6 +6752,7 @@ __metadata: react-dom: ^19.1.0 react-hook-form: ^7.56.2 react-international-phone: ^4.5.0 + react-intl: ^7 usehooks-ts: 3.1.1 languageName: unknown linkType: soft