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:
Anton Gunnarsson
2025-11-03 07:57:23 +00:00
parent a7593597a6
commit b2398dba4a
7 changed files with 57 additions and 13 deletions

View File

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

View File

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

View File

@@ -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",
})
}