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
This commit is contained in:
Anton Gunnarsson
2025-08-12 12:36:31 +00:00
parent 8518d018f8
commit 800dc5c3c1
74 changed files with 188 additions and 171 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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,

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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,

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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,

View File

@@ -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"

View File

@@ -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,

View File

@@ -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,

View File

@@ -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({

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -1,79 +0,0 @@
"use client"
import { useIntl } from "react-intl"
import { Typography } from "@scandic-hotels/design-system/Typography"
import styles from "./parkingList.module.css"
import type { ParkingListProps } from "@/types/components/hotelPage/sidepeek/parking"
export default function ParkingList({
numberOfChargingSpaces,
canMakeReservation,
numberOfParkingSpots,
distanceToHotel,
address,
}: ParkingListProps) {
const intl = useIntl()
const canMakeReservationYesMsg = intl.formatMessage({
defaultMessage: "Parking can be reserved in advance: Yes",
})
const canMakeReservationNoMsg = intl.formatMessage({
defaultMessage: "Parking can be reserved in advance: No",
})
return (
<Typography variant="Body/Paragraph/mdRegular">
<ul className={styles.listStyling}>
{numberOfChargingSpaces ? (
<li>
{intl.formatMessage(
{
defaultMessage:
"Number of charging points for electric cars: {number}",
},
{ number: numberOfChargingSpaces }
)}
</li>
) : null}
<li>
{canMakeReservation
? canMakeReservationYesMsg
: canMakeReservationNoMsg}
</li>
{numberOfParkingSpots ? (
<li>
{intl.formatMessage(
{
defaultMessage: "Number of parking spots: {number}",
},
{ number: numberOfParkingSpots }
)}
</li>
) : null}
{distanceToHotel ? (
<li>
{intl.formatMessage(
{
defaultMessage: "Distance to hotel: {distanceInM} m",
},
{ distanceInM: distanceToHotel }
)}
</li>
) : null}
{address ? (
<li>
{intl.formatMessage(
{
defaultMessage: "Address: {address}",
},
{ address }
)}
</li>
) : null}
</ul>
</Typography>
)
}

View File

@@ -1,11 +0,0 @@
.listStyling {
list-style-type: none;
}
.listStyling > li::before {
content: url("/_static/icons/heart.svg");
position: relative;
height: 8px;
top: 3px;
margin-right: var(--Spacing-x1);
}

View File

@@ -1,83 +0,0 @@
"use client"
import { useIntl } from "react-intl"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { formatPrice } from "@/utils/numberFormatting"
import { getPeriod } from "./utils"
import styles from "./parkingPrices.module.css"
import {
type ParkingPricesProps,
Periods,
} from "@/types/components/hotelPage/sidepeek/parking"
export default function ParkingPrices({
currency = "",
freeParking,
pricing,
}: ParkingPricesProps) {
const intl = useIntl()
if (freeParking) {
return (
<Typography variant="Body/Paragraph/mdBold">
<p className={styles.wrapper}>
{intl.formatMessage({ defaultMessage: "Free parking" })}
</p>
</Typography>
)
}
const filteredPricing = pricing.filter((price) => price.amount > 0)
if (filteredPricing.length === 0) {
return (
<dl className={styles.wrapper}>
<div className={styles.period}>
<div className={styles.information}>
<Typography variant="Body/Paragraph/mdBold">
<dt>{getPeriod(intl, "Hour")}</dt>
</Typography>
<Typography variant="Body/Paragraph/mdRegular">
<dd>
{intl.formatMessage({
defaultMessage: "At a cost",
})}
</dd>
</Typography>
</div>
</div>
</dl>
)
}
return (
<dl className={styles.wrapper}>
{filteredPricing.map(({ period, amount, startTime, endTime }) => (
<div key={period} className={styles.period}>
<div className={styles.information}>
<Typography variant="Body/Paragraph/mdBold">
<dt>{getPeriod(intl, period)}</dt>
</Typography>
<Typography variant="Body/Paragraph/mdRegular">
<dd>{formatPrice(intl, amount, currency)}</dd>
</Typography>
</div>
{startTime && endTime && period !== Periods.allDay ? (
<Typography variant="Body/Paragraph/mdRegular">
<div className={styles.information}>
<dt>{intl.formatMessage({ defaultMessage: "From" })}</dt>
{/* eslint-disable formatjs/no-literal-string-in-jsx */}
<dd>{`${startTime}-${endTime}`}</dd>
</div>
</Typography>
) : null}
</div>
))}
</dl>
)
}

View File

@@ -1,20 +0,0 @@
.wrapper {
display: grid;
row-gap: var(--Spacing-x1);
margin: 0;
color: var(--Text-Default);
}
.period {
display: flex;
gap: var(--Spacing-x5);
}
.information {
margin: 0;
flex: 1;
}
.priceHeading {
color: var(--Text-Secondary);
}

View File

@@ -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
}
}

View File

@@ -1,92 +0,0 @@
"use client"
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 ParkingList from "./ParkingList"
import ParkingPrices from "./ParkingPrices"
import styles from "./parkingInformation.module.css"
import type { Parking } from "@scandic-hotels/trpc/types/hotel"
interface ParkingInformationProps {
parking: Parking
showExternalParkingButton?: boolean
}
export default function ParkingInformation({
parking,
showExternalParkingButton = true,
}: ParkingInformationProps) {
const intl = useIntl()
const title = `${parking.type}${parking.name ? ` (${parking.name})` : ""}`
return (
<div className={styles.parkingInformation}>
<div className={styles.list}>
<Typography variant="Title/Subtitle/md">
<h4 className={styles.heading}>{title}</h4>
</Typography>
<ParkingList
numberOfChargingSpaces={parking.numberOfChargingSpaces}
canMakeReservation={parking.canMakeReservation}
numberOfParkingSpots={parking.numberOfParkingSpots}
distanceToHotel={parking.distanceToHotel}
address={parking.address}
/>
</div>
<div className={styles.prices}>
<Typography variant="Body/Paragraph/mdBold">
<h5 className={styles.heading}>
{intl.formatMessage({ defaultMessage: "Prices" })}
</h5>
</Typography>
<div className={styles.priceWrapper}>
<Typography variant="Title/Overline/sm">
<h6 className={styles.priceHeading}>
{intl.formatMessage({ defaultMessage: "Weekday prices" })}
</h6>
</Typography>
<Divider />
{parking.pricing.localCurrency ? (
<ParkingPrices
currency={parking.pricing.localCurrency.currency}
freeParking={parking.pricing.freeParking}
pricing={parking.pricing.localCurrency.ordinary}
/>
) : null}
</div>
<div className={styles.priceWrapper}>
<Typography variant="Title/Overline/sm">
<h6 className={styles.priceHeading}>
{intl.formatMessage({ defaultMessage: "Weekend prices" })}
</h6>
</Typography>
<Divider />
{parking.pricing.localCurrency ? (
<ParkingPrices
currency={parking.pricing.localCurrency.currency}
freeParking={parking.pricing.freeParking}
pricing={parking.pricing.localCurrency.weekend}
/>
) : null}
</div>
</div>
{parking.externalParkingUrl && showExternalParkingButton && (
<ButtonLink
typography="Body/Paragraph/mdBold"
href={parking.externalParkingUrl}
target="_blank"
>
{intl.formatMessage({ defaultMessage: "Book parking" })}
<MaterialIcon icon="open_in_new" color="CurrentColor" />
</ButtonLink>
)}
</div>
)
}

View File

@@ -1,26 +0,0 @@
.parkingInformation {
display: grid;
gap: var(--Spacing-x3);
}
.list,
.prices {
display: grid;
gap: var(--Spacing-x-one-and-half);
}
.priceWrapper {
background-color: var(--Base-Surface-Subtle-Normal);
border-radius: var(--Corner-radius-md);
padding: var(--Spacing-x2) var(--Spacing-x3);
display: grid;
gap: var(--Spacing-x1);
}
.heading {
color: var(--Text-Default);
}
.priceHeading {
color: var(--Text-Secondary);
}

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -4,6 +4,7 @@ import type {
Hotel,
Restaurant,
} from "@scandic-hotels/trpc/types/hotel"
import type { ParkingAmenityProps } from "./parking"
export type AmenitiesSidePeekProps = {

View File

@@ -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<Parking["pricing"], "freeParking">,
Pick<NonNullable<Parking["pricing"]["localCurrency"]>, "currency"> {
pricing: NonNullable<Parking["pricing"]["localCurrency"]>["ordinary"]
}

View File

@@ -1,41 +0,0 @@
import type { IntlShape } from "react-intl"
/**
* Function to parse number with single decimal if any
* @param n
* @returns number in float type with single digit decimal if any
*/
export function getSingleDecimal(n: Number | string) {
return parseFloat(Number(n).toFixed(1))
}
/**
* Function to parse number for i18n format for prices with currency
* @param intl - react-intl object
* @param price - number to be formatted
* @param currency - currency code
* @param additionalPrice - number (obtained in reward nights and Corporate cheque scenarios)
* @param additionalPriceCurrency - currency code (obtained in reward nights and Corporate cheque scenarios)
* @returns localized and formatted number in string type with currency
*/
export function formatPrice(
intl: IntlShape,
price: number,
currency: string,
additionalPrice?: number,
additionalPriceCurrency?: string
) {
const localizedPrice = intl.formatNumber(price, {
minimumFractionDigits: 0,
})
let formattedAdditionalPrice: string = ""
if (additionalPrice && additionalPriceCurrency) {
const localizedAdditionalPrice = intl.formatNumber(additionalPrice, {
minimumFractionDigits: 0,
})
formattedAdditionalPrice = ` + ${localizedAdditionalPrice} ${additionalPriceCurrency}`
}
return `${localizedPrice} ${currency}${formattedAdditionalPrice}`
}