Merged in feat/SW-3526-show-sas-eb-points-rate-in- (pull request #2933)

feat(SW-3526): Show EB points rate and label in booking flow

* feat(SW-3526): Show EB points rate and label in booking flow

* feat(SW-3526) Optimized points currency code

* feat(SW-3526) Removed extra multiplication for token expiry after rebase

* feat(SW-3526): Updated to exhaustive check and thow if type error

Approved-by: Anton Gunnarsson
This commit is contained in:
Hrishikesh Vaipurkar
2025-10-15 06:54:44 +00:00
parent 73af1eed9b
commit 78ede453a2
27 changed files with 281 additions and 176 deletions

View File

@@ -22,6 +22,7 @@ import { FacilityToIcon } from '../../../FacilityToIcon'
import { HotelPin } from '../../../Map/types'
import { HotelPointsRow } from '../../HotelPointsRow'
import styles from './standaloneHotelCardDialog.module.css'
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
interface StandaloneHotelCardProps {
data: HotelPin
@@ -29,6 +30,7 @@ interface StandaloneHotelCardProps {
isUserLoggedIn: boolean
handleClose: () => void
onClick?: () => void
pointsCurrency?: CurrencyEnum
}
export function StandaloneHotelCardDialog({
@@ -37,6 +39,7 @@ export function StandaloneHotelCardDialog({
handleClose,
isUserLoggedIn,
onClick,
pointsCurrency,
}: StandaloneHotelCardProps) {
const intl = useIntl()
const [imageError, setImageError] = useState(false)
@@ -224,7 +227,10 @@ export function StandaloneHotelCardDialog({
</Subtitle>
)}
{redemptionPrice && (
<HotelPointsRow pointsPerStay={redemptionPrice} />
<HotelPointsRow
pointsPerStay={redemptionPrice}
pointsCurrency={pointsCurrency}
/>
)}
</div>
{shouldShowNotEnoughPoints ? (

View File

@@ -4,16 +4,19 @@ import Caption from '../../Caption'
import Subtitle from '../../Subtitle'
import styles from './hotelPointsRow.module.css'
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
export type PointsRowProps = {
pointsPerStay: number
additionalPricePerStay?: number
additionalPriceCurrency?: string
pointsCurrency?: CurrencyEnum
}
export function HotelPointsRow({
pointsPerStay,
additionalPricePerStay,
additionalPriceCurrency,
pointsCurrency,
}: PointsRowProps) {
const intl = useIntl()
@@ -23,9 +26,10 @@ export function HotelPointsRow({
{pointsPerStay}
</Subtitle>
<Caption color="uiTextHighContrast">
{intl.formatMessage({
defaultMessage: 'Points',
})}
{pointsCurrency ??
intl.formatMessage({
defaultMessage: 'Points',
})}
</Caption>
{additionalPricePerStay ? (
<>

View File

@@ -106,6 +106,7 @@ export type HotelCardProps = {
state?: 'default' | 'active'
bookingCode?: string | null
isAlternative?: boolean
pointsCurrency?: CurrencyEnum
fullPrice: boolean
lang: Lang
@@ -127,6 +128,7 @@ export const HotelCard = memo(
type = 'pageListing',
bookingCode = '',
isAlternative,
pointsCurrency,
images,
lang,
belowInfoSlot,
@@ -307,6 +309,7 @@ export const HotelCard = memo(
additionalPriceCurrency={
redemption.localPrice.currency ?? undefined
}
pointsCurrency={pointsCurrency}
/>
))}
</div>

View File

@@ -10,6 +10,7 @@ import type { HotelPin as HotelPinType } from '../../types'
import styles from './hotelListingMapContent.module.css'
import { StandaloneHotelCardDialog } from '../../../HotelCard/HotelDialogCard/StandaloneHotelCardDialog'
import { Lang } from '@scandic-hotels/common/constants/language'
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
export type HotelListingMapContentProps = {
hotelPins: HotelPinType[]
@@ -17,6 +18,7 @@ export type HotelListingMapContentProps = {
hoveredHotel?: string | null
lang: Lang
isUserLoggedIn: boolean
pointsCurrency?: CurrencyEnum
onClickHotel?: (hotelId: string) => void
setActiveHotel?: (args: { hotelName: string; hotelId: string } | null) => void
setHoveredHotel?: (
@@ -32,6 +34,7 @@ export function HotelListingMapContent({
setHoveredHotel,
lang,
onClickHotel,
pointsCurrency,
}: HotelListingMapContentProps) {
const isDesktop = useMediaQuery('(min-width: 900px)')
@@ -104,6 +107,7 @@ export function HotelListingMapContent({
onClick={() => {
onClickHotel?.(pin.operaId)
}}
pointsCurrency={pointsCurrency}
/>
</InfoWindow>
)}

View File

@@ -18,6 +18,7 @@ import styles from './interactiveMap.module.css'
import { HotelPin, MarkerInfo, PointOfInterest } from '../types'
import { Lang } from '@scandic-hotels/common/constants/language'
import { CurrencyEnum } from '@scandic-hotels/common/constants/currency'
export type InteractiveMapProps = {
lang: Lang
@@ -27,6 +28,7 @@ export type InteractiveMapProps = {
}
activePoi?: string | null
hotelPins?: HotelPin[]
pointsCurrency?: CurrencyEnum
pointsOfInterest?: PointOfInterest[]
markerInfo?: MarkerInfo
mapId: string
@@ -73,6 +75,7 @@ export function InteractiveMap({
hoveredHotelPin,
activeHotelPin,
isUserLoggedIn,
pointsCurrency,
onClickHotel,
onHoverHotelPin,
onSetActiveHotelPin,
@@ -122,6 +125,7 @@ export function InteractiveMap({
activeHotel={activeHotelPin}
hoveredHotel={hoveredHotelPin}
onClickHotel={onClickHotel}
pointsCurrency={pointsCurrency}
/>
)}
{pointsOfInterest && markerInfo && (