Merged in feat/sw-3587-add-partner-copy-for-member-price (pull request #3053)
feat(SW-3587): Add new member price copy to partner variants * Add new member price copy to partner variants Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -13,7 +13,10 @@ import { useScrollToTop } from "@scandic-hotels/common/hooks/useScrollToTop"
|
||||
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
|
||||
import { HotelCard } from "@scandic-hotels/design-system/HotelCard"
|
||||
|
||||
import { useGetPointsCurrency } from "../../bookingFlowConfig/bookingFlowConfigContext"
|
||||
import {
|
||||
useBookingFlowConfig,
|
||||
useGetPointsCurrency,
|
||||
} from "../../bookingFlowConfig/bookingFlowConfigContext"
|
||||
import { useIsLoggedIn } from "../../hooks/useIsLoggedIn"
|
||||
import useLang from "../../hooks/useLang"
|
||||
import { mapApiImagesToGalleryImages } from "../../misc/imageGallery"
|
||||
@@ -60,6 +63,7 @@ export default function HotelCardListing({
|
||||
const { showBackToTop, scrollToTop } = useScrollToTop({ threshold: 490 })
|
||||
const activeCardRef = useRef<HTMLDivElement | null>(null)
|
||||
const pointsCurrency = useGetPointsCurrency()
|
||||
const config = useBookingFlowConfig()
|
||||
|
||||
const sortBy = searchParams.get("sort") ?? DEFAULT_SORT
|
||||
|
||||
@@ -250,6 +254,7 @@ export default function HotelCardListing({
|
||||
bookingCode={bookingCode}
|
||||
isCampaignWithBookingCode={isCampaignWithBookingCode}
|
||||
isAlternative={isAlternative}
|
||||
isPartnerBrand={config.variant !== "scandic"}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useIntl } from "react-intl"
|
||||
import CampaignRateCard from "@scandic-hotels/design-system/CampaignRateCard"
|
||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
||||
|
||||
import { useBookingFlowConfig } from "../../../../../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||
import { useSelectRateContext } from "../../../../../../../contexts/SelectRate/SelectRateContext"
|
||||
import { useIsLoggedIn } from "../../../../../../../hooks/useIsLoggedIn"
|
||||
import { BookingCodeFilterEnum } from "../../../../../../../stores/bookingCode-filter"
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
sumPackagesRequestedPrice,
|
||||
} from "../../../../../../../utils/SelectRate"
|
||||
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
||||
import { getMemberPriceMessage } from "./translation-utils"
|
||||
import { useRateTitles } from "./useRateTitles"
|
||||
|
||||
import type {
|
||||
@@ -82,6 +84,7 @@ function Inner({
|
||||
isRateSelected,
|
||||
actions: { selectRate },
|
||||
} = useSelectRateContext()
|
||||
const config = useBookingFlowConfig()
|
||||
|
||||
const rateTitles = useRateTitles()
|
||||
const isUserLoggedIn = useIsLoggedIn()
|
||||
@@ -98,10 +101,7 @@ function Inner({
|
||||
defaultMessage: "Standard price",
|
||||
})
|
||||
|
||||
const memberPriceMsg = intl.formatMessage({
|
||||
id: "booking.memberPrice",
|
||||
defaultMessage: "Member price",
|
||||
})
|
||||
const memberPriceMsg = getMemberPriceMessage(intl, config)
|
||||
|
||||
if (!product.public || (isUserLoggedIn && !product.member)) {
|
||||
return (
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useIntl } from "react-intl"
|
||||
import NoRateAvailableCard from "@scandic-hotels/design-system/NoRateAvailableCard"
|
||||
import RegularRateCard from "@scandic-hotels/design-system/RegularRateCard"
|
||||
|
||||
import { useBookingFlowConfig } from "../../../../../../../bookingFlowConfig/bookingFlowConfigContext"
|
||||
import { useSelectRateContext } from "../../../../../../../contexts/SelectRate/SelectRateContext"
|
||||
import { useIsLoggedIn } from "../../../../../../../hooks/useIsLoggedIn"
|
||||
import { BookingCodeFilterEnum } from "../../../../../../../stores/bookingCode-filter"
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
sumPackagesRequestedPrice,
|
||||
} from "../../../../../../../utils/SelectRate"
|
||||
import { calculatePricePerNightPriceProduct } from "./totalPricePerNight"
|
||||
import { getMemberPriceMessage } from "./translation-utils"
|
||||
import { useRateTitles } from "./useRateTitles"
|
||||
|
||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||
@@ -81,6 +83,7 @@ function Inner({
|
||||
bookingCodeFilter,
|
||||
actions: { selectRate },
|
||||
} = useSelectRateContext()
|
||||
const config = useBookingFlowConfig()
|
||||
|
||||
const isMainRoom = roomIndex === 0
|
||||
|
||||
@@ -102,10 +105,7 @@ function Inner({
|
||||
defaultMessage: "Standard price",
|
||||
})
|
||||
|
||||
const memberPriceMsg = intl.formatMessage({
|
||||
id: "booking.memberPrice",
|
||||
defaultMessage: "Member price",
|
||||
})
|
||||
const memberPriceMsg = getMemberPriceMessage(intl, config)
|
||||
|
||||
const approxMsg = intl.formatMessage({
|
||||
id: "booking.approx",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
import type { BookingFlowConfig } from "../../../../../../../bookingFlowConfig/bookingFlowConfig"
|
||||
|
||||
export function getMemberPriceMessage(
|
||||
intl: IntlShape,
|
||||
config: BookingFlowConfig
|
||||
) {
|
||||
if (config.variant !== "scandic") {
|
||||
return intl.formatMessage({
|
||||
id: "booking.scandicFriendsMemberPrice",
|
||||
defaultMessage: "Scandic Friends member price",
|
||||
description: {
|
||||
context: "Member price label in white label partner sites",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return intl.formatMessage({
|
||||
id: "booking.memberPrice",
|
||||
defaultMessage: "Member price",
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user