Merged in fix/refactor-currency-display (pull request #3434)

fix(SW-3616): Handle EuroBonus point type everywhere

* Add tests to formatPrice

* formatPrice

* More work replacing config with api points type

* More work replacing config with api points type

* More fixing with currency

* maybe actually fixed it

* Fix MyStay

* Clean up

* Fix comments

* Merge branch 'master' into fix/refactor-currency-display

* Fix calculateTotalPrice for EB points + SF points + cash


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2026-01-15 09:32:17 +00:00
parent c61ddaf94d
commit 16fbdb7ae0
59 changed files with 729 additions and 282 deletions

View File

@@ -9,7 +9,6 @@ import { Typography } from "../../../Typography"
import { HotelCardDialogImage } from "../../HotelCardDialogImage"
import { NoPriceAvailableCard } from "../../NoPriceAvailableCard"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { Lang } from "@scandic-hotels/common/constants/language"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { useUrlWithSearchParam } from "@scandic-hotels/common/hooks/useUrlWithSearchParam"
@@ -26,7 +25,6 @@ interface StandaloneHotelCardProps {
isUserLoggedIn: boolean
handleClose: () => void
onClick?: () => void
pointsCurrency?: CurrencyEnum
}
export function StandaloneHotelCardDialog({
@@ -35,7 +33,6 @@ export function StandaloneHotelCardDialog({
handleClose,
isUserLoggedIn,
onClick,
pointsCurrency,
}: StandaloneHotelCardProps) {
const intl = useIntl()
const [imageError, setImageError] = useState(false)
@@ -45,6 +42,7 @@ export function StandaloneHotelCardDialog({
publicPrice,
memberPrice,
redemptionPrice,
pointsType,
voucherPrice,
currency,
amenities,
@@ -183,7 +181,7 @@ export function StandaloneHotelCardDialog({
{redemptionPrice ? (
<HotelPointsRow
pointsPerStay={redemptionPrice}
pointsCurrency={pointsCurrency}
pointsType={pointsType}
/>
) : null}
</div>

View File

@@ -3,34 +3,37 @@ import { useIntl } from "react-intl"
import { RoomPrice } from "../../HotelCard/RoomPrice"
import { Typography } from "../../Typography"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import styles from "./hotelPointsRow.module.css"
import { PointType } from "@scandic-hotels/common/constants/pointType"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
import { getCurrencyText } from "../../currency-utils"
export type PointsRowProps = {
pointsPerStay: number
additionalPricePerStay?: number
additionalPriceCurrency?: string
pointsCurrency?: CurrencyEnum
pointsType: PointType | null
}
export function HotelPointsRow({
pointsPerStay,
additionalPricePerStay,
additionalPriceCurrency,
pointsCurrency,
pointsType,
}: PointsRowProps) {
const intl = useIntl()
const currency = getCurrencyText(
intl,
CurrencyEnum.POINTS,
pointsPerStay,
pointsType
)
return (
<RoomPrice
className={styles.roomPrice}
price={pointsPerStay}
currency={
pointsCurrency ??
intl.formatMessage({
id: "common.points",
defaultMessage: "Points",
})
}
currency={currency}
includePerNight={false}
>
{additionalPricePerStay ? (

View File

@@ -36,6 +36,7 @@ import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
import { BookingCodeChip } from "../BookingCodeChip"
import { FakeButton } from "../FakeButton"
import { TripAdvisorChip } from "../TripAdvisorChip"
import { PointType } from "@scandic-hotels/common/constants/pointType"
type Price = {
pricePerStay: number
@@ -96,6 +97,7 @@ export type HotelCardProps = {
additionalPricePerStay: number
pointsPerStay: number
currency: CurrencyEnum | null | undefined
pointsType?: PointType | null
}
}[]
}
@@ -108,7 +110,6 @@ export type HotelCardProps = {
bookingCode?: string | null
isAlternative?: boolean
isPartnerBrand: boolean
pointsCurrency?: CurrencyEnum
fullPrice: boolean
isCampaignWithBookingCode: boolean
lang: Lang
@@ -133,7 +134,6 @@ export const HotelCardComponent = memo(
bookingCode = "",
isAlternative,
isPartnerBrand,
pointsCurrency,
images,
lang,
belowInfoSlot,
@@ -358,7 +358,7 @@ export const HotelCardComponent = memo(
additionalPriceCurrency={
redemption.localPrice.currency ?? undefined
}
pointsCurrency={pointsCurrency}
pointsType={redemption.localPrice.pointsType ?? null}
/>
))}
</div>