Merged in feature/SW-3515-join-scandic-friends-placeholder (pull request #2883)
feat(SW-3515): display placeholder for join scandic friends * feat(SW-3515): display placeholder for join scandic friends * add missing variant config Approved-by: Linus Flood
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { ScandicPartnersEnum } from "@scandic-hotels/common/constants/scandicPartners"
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
import { phoneErrors } from "@scandic-hotels/common/utils/zod/phoneValidator"
|
||||
|
||||
@@ -10,10 +9,12 @@ import {
|
||||
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
import type { BookingFlowVariant } from "../../bookingFlowConfig/bookingFlowVariants"
|
||||
|
||||
export function getErrorMessage(
|
||||
intl: IntlShape,
|
||||
errorCode?: string,
|
||||
partner?: ScandicPartnersEnum
|
||||
variant: BookingFlowVariant,
|
||||
errorCode?: string
|
||||
) {
|
||||
switch (errorCode) {
|
||||
case bookingWidgetErrors.BOOKING_CODE_INVALID:
|
||||
@@ -47,7 +48,7 @@ export function getErrorMessage(
|
||||
"Multi-room booking is not available with this booking code.",
|
||||
})
|
||||
case bookingWidgetErrors.MULTIROOM_REWARD_NIGHT_UNAVAILABLE:
|
||||
return partner === ScandicPartnersEnum.sas
|
||||
return variant === "partner-sas"
|
||||
? intl.formatMessage({
|
||||
defaultMessage:
|
||||
"Multi-room bookings are not available with EuroBonus points.",
|
||||
|
||||
@@ -17,6 +17,7 @@ import Caption from "@scandic-hotels/design-system/Caption"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Input as InputWithLabel } from "@scandic-hotels/design-system/Input"
|
||||
|
||||
import { useBookingFlowConfig } from "../../bookingFlowConfig/bookingFlowConfigContext"
|
||||
import { getErrorMessage } from "./errors"
|
||||
|
||||
import styles from "./input.module.css"
|
||||
@@ -51,6 +52,7 @@ const BookingFlowInput = forwardRef<HTMLInputElement, InputProps>(
|
||||
) {
|
||||
const intl = useIntl()
|
||||
const { control } = useFormContext()
|
||||
const config = useBookingFlowConfig()
|
||||
|
||||
return (
|
||||
<Controller
|
||||
@@ -96,7 +98,11 @@ const BookingFlowInput = forwardRef<HTMLInputElement, InputProps>(
|
||||
{fieldState.error && !hideError ? (
|
||||
<Caption className={styles.error} fontOnly>
|
||||
<MaterialIcon icon="info" color="Icon/Feedback/Error" />
|
||||
{getErrorMessage(intl, fieldState.error.message)}
|
||||
{getErrorMessage(
|
||||
intl,
|
||||
config.variant,
|
||||
fieldState.error.message
|
||||
)}
|
||||
</Caption>
|
||||
) : null}
|
||||
</TextField>
|
||||
|
||||
Reference in New Issue
Block a user