Merged in chore/SW-3246-move-alert-to-design-system (pull request #2698)

chore(SW-3246): Moved Alert component into design system

* chore(SW-3246): Moved Alert component into design system

* chore(SW-3246): Optimsed code and imports

* chore(SW-3246): Moved type AlertTypeEnum and other to common package


Approved-by: Anton Gunnarsson
This commit is contained in:
Hrishikesh Vaipurkar
2025-08-26 11:22:38 +00:00
parent 4c9605ef3f
commit 44fce176e9
39 changed files with 135 additions and 120 deletions

View File

@@ -3,14 +3,14 @@
import { useRef } from "react" import { useRef } from "react"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton" import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useDestinationDataStore } from "@/stores/destination-data" import { useDestinationDataStore } from "@/stores/destination-data"
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort" import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
import Alert from "@/components/TempDesignSystem/Alert"
import { useScrollToTop } from "@/hooks/useScrollToTop" import { useScrollToTop } from "@/hooks/useScrollToTop"
import CityListingItem from "./CityListingItem" import CityListingItem from "./CityListingItem"

View File

@@ -3,9 +3,8 @@
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts" import { useMediaQuery } from "usehooks-ts"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Alert from "@/components/TempDesignSystem/Alert"
import HotelCardCarousel from "../../../HotelCardCarousel" import HotelCardCarousel from "../../../HotelCardCarousel"
import HotelListItem from "../HotelListItem" import HotelListItem from "../HotelListItem"

View File

@@ -2,13 +2,13 @@
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Body from "@scandic-hotels/design-system/Body" import Body from "@scandic-hotels/design-system/Body"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useDestinationDataStore } from "@/stores/destination-data" import { useDestinationDataStore } from "@/stores/destination-data"
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort" import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
import Alert from "@/components/TempDesignSystem/Alert"
import CityListItem from "../CityListItem" import CityListItem from "../CityListItem"
import CityListSkeleton from "./CityListSkeleton" import CityListSkeleton from "./CityListSkeleton"

View File

@@ -5,16 +5,16 @@ import { useParams } from "next/navigation"
import { useEffect, useRef, useState } from "react" import { useEffect, useRef, useState } from "react"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton" import { BackToTopButton } from "@scandic-hotels/design-system/BackToTopButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useDestinationDataStore } from "@/stores/destination-data" import { useDestinationDataStore } from "@/stores/destination-data"
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort" import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
import Alert from "@/components/TempDesignSystem/Alert"
import { useScrollToTop } from "@/hooks/useScrollToTop" import { useScrollToTop } from "@/hooks/useScrollToTop"
import HotelListingItem from "./HotelListingItem" import HotelListingItem from "./HotelListingItem"

View File

@@ -3,6 +3,7 @@ import { Suspense } from "react"
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { safeTry } from "@scandic-hotels/common/utils/safeTry" import { safeTry } from "@scandic-hotels/common/utils/safeTry"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Link from "@scandic-hotels/design-system/Link" import Link from "@scandic-hotels/design-system/Link"
import { import {
@@ -14,7 +15,6 @@ import {
import AccordionSection from "@/components/Blocks/Accordion" import AccordionSection from "@/components/Blocks/Accordion"
import Breadcrumbs from "@/components/Breadcrumbs" import Breadcrumbs from "@/components/Breadcrumbs"
import HotelCampaigns from "@/components/ContentType/HotelPage/Campaigns" import HotelCampaigns from "@/components/ContentType/HotelPage/Campaigns"
import Alert from "@/components/TempDesignSystem/Alert"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton" import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
import TrackingSDK from "@/components/TrackingSDK" import TrackingSDK from "@/components/TrackingSDK"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"

View File

@@ -10,16 +10,16 @@ import {
} from "react-aria-components" } from "react-aria-components"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { Divider } from "@scandic-hotels/design-system/Divider" import { Divider } from "@scandic-hotels/design-system/Divider"
import Footnote from "@scandic-hotels/design-system/Footnote" import Footnote from "@scandic-hotels/design-system/Footnote"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton"
import Subtitle from "@scandic-hotels/design-system/Subtitle" import Subtitle from "@scandic-hotels/design-system/Subtitle"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useDestinationDataStore } from "@/stores/destination-data" import { useDestinationDataStore } from "@/stores/destination-data"
import Alert from "../TempDesignSystem/Alert"
import Filter from "./Filter" import Filter from "./Filter"
import Sort from "./Sort" import Sort from "./Sort"

View File

@@ -9,16 +9,16 @@ import {
} from "react-aria-components" } from "react-aria-components"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { Button } from "@scandic-hotels/design-system/Button" import { Button } from "@scandic-hotels/design-system/Button"
import { Divider } from "@scandic-hotels/design-system/Divider" import { Divider } from "@scandic-hotels/design-system/Divider"
import { IconButton } from "@scandic-hotels/design-system/IconButton" import { IconButton } from "@scandic-hotels/design-system/IconButton"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useHotelListingDataStore } from "@/stores/hotel-listing-data" import { useHotelListingDataStore } from "@/stores/hotel-listing-data"
import Alert from "../TempDesignSystem/Alert"
import Filter from "./Filter" import Filter from "./Filter"
import Sort from "./Sort" import Sort from "./Sort"

View File

@@ -1,8 +1,9 @@
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { Divider } from "@scandic-hotels/design-system/Divider" import { Divider } from "@scandic-hotels/design-system/Divider"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests" import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
@@ -12,7 +13,6 @@ import Promos from "@/components/HotelReservation/BookingConfirmation/Promos"
import Receipt from "@/components/HotelReservation/BookingConfirmation/Receipt" import Receipt from "@/components/HotelReservation/BookingConfirmation/Receipt"
import Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms" import Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms"
import SidePanel from "@/components/HotelReservation/SidePanel" import SidePanel from "@/components/HotelReservation/SidePanel"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider" import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"

View File

@@ -4,14 +4,14 @@ import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useRef, useState } from "react" import { useEffect, useRef, useState } from "react"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation" import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition" import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode" import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useEnterDetailsStore } from "@/stores/enter-details" import { useEnterDetailsStore } from "@/stores/enter-details"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang" import useLang from "@/hooks/useLang"
import styles from "./bookingAlert.module.css" import styles from "./bookingAlert.module.css"

View File

@@ -1,6 +1,6 @@
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import styles from "./FnFNotAllowedAlert.module.css" import styles from "./FnFNotAllowedAlert.module.css"

View File

@@ -1,13 +1,14 @@
import { useWatch } from "react-hook-form" import { useWatch } from "react-hook-form"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Link from "@scandic-hotels/design-system/Link" import Link from "@scandic-hotels/design-system/Link"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs"
import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow" import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow"
@@ -15,7 +16,6 @@ import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow"
import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Payment/PaymentOptionsGroup" import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Payment/PaymentOptionsGroup"
import MySavedCards from "@/components/HotelReservation/MySavedCards" import MySavedCards from "@/components/HotelReservation/MySavedCards"
import PaymentOption from "@/components/HotelReservation/PaymentOption" import PaymentOption from "@/components/HotelReservation/PaymentOption"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang" import useLang from "@/hooks/useLang"
import styles from "./confirmationStep.module.css" import styles from "./confirmationStep.module.css"

View File

@@ -1,15 +1,15 @@
import { useFormContext } from "react-hook-form" import { useFormContext } from "react-hook-form"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Body from "@scandic-hotels/design-system/Body" import Body from "@scandic-hotels/design-system/Body"
import { ErrorMessage } from "@scandic-hotels/design-system/Form/ErrorMessage" import { ErrorMessage } from "@scandic-hotels/design-system/Form/ErrorMessage"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow" import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow"
import Alert from "@/components/TempDesignSystem/Alert"
import Select from "@/components/TempDesignSystem/Form/Select" import Select from "@/components/TempDesignSystem/Form/Select"
import { getErrorMessage } from "@/utils/getErrorMessage" import { getErrorMessage } from "@/utils/getErrorMessage"

View File

@@ -2,10 +2,10 @@
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import Alert from "@/components/TempDesignSystem/Alert"
import { trackMyStayPageLink } from "@/utils/tracking" import { trackMyStayPageLink } from "@/utils/tracking"
import SummaryCard from "./SummaryCard" import SummaryCard from "./SummaryCard"

View File

@@ -1,12 +1,12 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { useMyStayStore } from "@/stores/my-stay" import { useMyStayStore } from "@/stores/my-stay"
import Modal from "@/components/HotelReservation/MyStay/Modal" import Modal from "@/components/HotelReservation/MyStay/Modal"
import Alert from "@/components/TempDesignSystem/Alert"
interface AlertsProps extends React.PropsWithChildren { interface AlertsProps extends React.PropsWithChildren {
closeModal: () => void closeModal: () => void

View File

@@ -1,10 +1,10 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Modal from "@/components/HotelReservation/MyStay/Modal" import Modal from "@/components/HotelReservation/MyStay/Modal"
import Alert from "@/components/TempDesignSystem/Alert"
export default function CannotChangeDate({ export default function CannotChangeDate({
closeModal, closeModal,

View File

@@ -1,10 +1,10 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Modal from "@/components/HotelReservation/MyStay/Modal" import Modal from "@/components/HotelReservation/MyStay/Modal"
import Alert from "@/components/TempDesignSystem/Alert"
export default function MultiRoomBooking({ export default function MultiRoomBooking({
closeModal, closeModal,

View File

@@ -1,10 +1,10 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Modal from "@/components/HotelReservation/MyStay/Modal" import Modal from "@/components/HotelReservation/MyStay/Modal"
import Alert from "@/components/TempDesignSystem/Alert"
export default function NotMainRoom({ export default function NotMainRoom({
closeModal, closeModal,

View File

@@ -1,9 +1,8 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Alert from "@/components/TempDesignSystem/Alert"
export default function NoAvailability() { export default function NoAvailability() {
const intl = useIntl() const intl = useIntl()

View File

@@ -1,7 +1,7 @@
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation" import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { Alert } from "@scandic-hotels/design-system/Alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { getLang } from "@/i18n/serverContext" import { getLang } from "@/i18n/serverContext"

View File

@@ -4,11 +4,11 @@ import { useState } from "react"
import { Button as ButtonRAC } from "react-aria-components" import { Button as ButtonRAC } from "react-aria-components"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon" import { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import HotelDetailsSidePeek from "@/components/SidePeeks/HotelDetailsSidePeek" import HotelDetailsSidePeek from "@/components/SidePeeks/HotelDetailsSidePeek"
import Alert from "@/components/TempDesignSystem/Alert"
import styles from "./hotelDescription.module.css" import styles from "./hotelDescription.module.css"

View File

@@ -1,5 +1,6 @@
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting" import { getSingleDecimal } from "@scandic-hotels/common/utils/numberFormatting"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { Divider } from "@scandic-hotels/design-system/Divider" import { Divider } from "@scandic-hotels/design-system/Divider"
import { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon" import { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon"
import ImageGallery from "@scandic-hotels/design-system/ImageGallery" import ImageGallery from "@scandic-hotels/design-system/ImageGallery"
@@ -8,7 +9,6 @@ import { TripAdvisorChip } from "@scandic-hotels/design-system/TripAdvisorChip"
import { Typography } from "@scandic-hotels/design-system/Typography" import { Typography } from "@scandic-hotels/design-system/Typography"
import HotelDetailsSidePeek from "@/components/SidePeeks/HotelDetailsSidePeek" import HotelDetailsSidePeek from "@/components/SidePeeks/HotelDetailsSidePeek"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n" import { getIntl } from "@/i18n"
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery" import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"

View File

@@ -1,11 +1,11 @@
"use client" "use client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation" import { alternativeHotels } from "@scandic-hotels/common/constants/routes/hotelReservation"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
import useLang from "@/hooks/useLang" import useLang from "@/hooks/useLang"

View File

@@ -3,9 +3,9 @@
import { TRPCClientError } from "@trpc/client" import { TRPCClientError } from "@trpc/client"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext" import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
import { RateSummary } from "./RateSummary" import { RateSummary } from "./RateSummary"

View File

@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest" import { describe, expect, it } from "vitest"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { getHotelAlertsForBookingDates } from "./index" import { getHotelAlertsForBookingDates } from "./index"

View File

@@ -3,12 +3,11 @@
import { useRouter, useSearchParams } from "next/navigation" import { useRouter, useSearchParams } from "next/navigation"
import { useIntl } from "react-intl" import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { DTMC_SUCCESS_BANNER_KEY } from "@/constants/dtmc" import { DTMC_SUCCESS_BANNER_KEY } from "@/constants/dtmc"
import Alert from "@/components/TempDesignSystem/Alert"
export default function DigitalTeamMemberCardAlert() { export default function DigitalTeamMemberCardAlert() {
const intl = useIntl() const intl = useIntl()
const router = useRouter() const router = useRouter()

View File

@@ -2,13 +2,13 @@
import { useCallback, useRef } from "react" import { useCallback, useRef } from "react"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition" import useStickyPosition from "@scandic-hotels/common/hooks/useStickyPosition"
import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position" import { StickyElementNameEnum } from "@scandic-hotels/common/stores/sticky-position"
import { debounce } from "@scandic-hotels/common/utils/debounce" import { debounce } from "@scandic-hotels/common/utils/debounce"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { trpc } from "@scandic-hotels/trpc/client" import { trpc } from "@scandic-hotels/trpc/client"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang" import useLang from "@/hooks/useLang"
import styles from "./sitewideAlert.module.css" import styles from "./sitewideAlert.module.css"

View File

@@ -9,3 +9,13 @@ export const AlertVisibleOnEnum = {
WEB: "WEB", WEB: "WEB",
APP: "APP", APP: "APP",
} as const } as const
export type SidepeekContent = {
heading: string
content: {
json?: any
embedded_itemsConnection: {
edges: any
}
}
}

View File

@@ -33,6 +33,7 @@
"./utils/isValidJson": "./utils/isValidJson.ts", "./utils/isValidJson": "./utils/isValidJson.ts",
"./hooks/*": "./hooks/*.ts", "./hooks/*": "./hooks/*.ts",
"./stores/*": "./stores/*.ts", "./stores/*": "./stores/*.ts",
"./constants/alert": "./constants/alert.ts",
"./constants/currency": "./constants/currency.ts", "./constants/currency": "./constants/currency.ts",
"./constants/dateFormats": "./constants/dateFormats.ts", "./constants/dateFormats": "./constants/dateFormats.ts",
"./constants/facilities": "./constants/facilities.ts", "./constants/facilities": "./constants/facilities.ts",

View File

@@ -1,16 +1,16 @@
"use client" 'use client'
import { useState } from "react" import { useState } from 'react'
import { useIntl } from "react-intl" import { useIntl } from 'react-intl'
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { MaterialIcon } from '../../Icons/MaterialIcon'
import { JsonToHtml } from "@scandic-hotels/design-system/JsonToHtml" import { JsonToHtml } from '../../JsonToHtml/JsonToHtml'
import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import { Button } from '../../Button'
import SidePeek from "@scandic-hotels/design-system/SidePeek" import SidePeek from '../../SidePeek'
import styles from "./sidepeek.module.css" import styles from './sidepeek.module.css'
import type { AlertSidepeekProps } from "./sidepeek" import type { AlertSidepeekProps } from './sidepeek'
export default function AlertSidepeek({ export default function AlertSidepeek({
ctaText, ctaText,
@@ -24,11 +24,11 @@ export default function AlertSidepeek({
<div className={styles.alertSidepeek}> <div className={styles.alertSidepeek}>
<Button <Button
onPress={() => setSidePeekIsOpen(true)} onPress={() => setSidePeekIsOpen(true)}
theme="base" variant="Text"
variant="icon" color="Primary"
intent="text" size="Small"
size="small"
wrapping wrapping
typography="Body/Supporting text (caption)/smBold"
> >
{ctaText} {ctaText}
<MaterialIcon icon="chevron_right" size={20} color="CurrentColor" /> <MaterialIcon icon="chevron_right" size={20} color="CurrentColor" />
@@ -39,7 +39,7 @@ export default function AlertSidepeek({
isOpen={sidePeekIsOpen} isOpen={sidePeekIsOpen}
handleClose={() => setSidePeekIsOpen(false)} handleClose={() => setSidePeekIsOpen(false)}
closeLabel={intl.formatMessage({ closeLabel={intl.formatMessage({
defaultMessage: "Close", defaultMessage: 'Close',
})} })}
> >
<JsonToHtml <JsonToHtml

View File

@@ -1,4 +1,4 @@
import type { SidepeekContent } from "@scandic-hotels/trpc/types/siteConfig" import type { SidepeekContent } from '@scandic-hotels/common/constants/alert'
export interface AlertSidepeekProps { export interface AlertSidepeekProps {
ctaText: string ctaText: string

View File

@@ -1,9 +1,11 @@
import type { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import type {
import type { SidepeekContent } from "@scandic-hotels/trpc/types/siteConfig" AlertTypeEnum,
import type { VariantProps } from "class-variance-authority" SidepeekContent,
import type { AriaRole } from "react" } from '@scandic-hotels/common/constants/alert'
import type { VariantProps } from 'class-variance-authority'
import type { AriaRole } from 'react'
import type { alertVariants } from "./variants" import type { alertVariants } from './variants'
export interface AlertProps extends VariantProps<typeof alertVariants> { export interface AlertProps extends VariantProps<typeof alertVariants> {
className?: string className?: string
@@ -24,5 +26,5 @@ export interface AlertProps extends VariantProps<typeof alertVariants> {
} | null } | null
close?: () => void close?: () => void
ariaRole?: AriaRole ariaRole?: AriaRole
ariaLive?: "off" | "assertive" | "polite" ariaLive?: 'off' | 'assertive' | 'polite'
} }

View File

@@ -1,19 +1,19 @@
"use client" 'use client'
import Body from "@scandic-hotels/design-system/Body" import { Button } from '../Button'
import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from '../Icons/MaterialIcon'
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Link from '../Link'
import Link from "@scandic-hotels/design-system/Link" import { Typography } from '../Typography'
import AlertSidepeek from "./Sidepeek" import AlertSidepeek from './Sidepeek'
import { IconByAlertType } from "./utils" import { IconByAlertType } from './utils'
import { alertVariants } from "./variants" import { alertVariants } from './variants'
import styles from "./alert.module.css" import styles from './alert.module.css'
import type { AlertProps } from "./alert" import type { AlertProps } from './alert'
export default function Alert({ export function Alert({
className, className,
variant, variant,
type, type,
@@ -49,30 +49,32 @@ export default function Alert({
<div className={styles.innerContent}> <div className={styles.innerContent}>
<div className={styles.textWrapper}> <div className={styles.textWrapper}>
{heading ? ( {heading ? (
<Body textTransform="bold" asChild> <Typography variant="Body/Paragraph/mdBold">
<h2>{heading}</h2> <h2>{heading}</h2>
</Body> </Typography>
) : null} ) : null}
{text ? ( {text ? (
<Body> <Typography variant="Body/Paragraph/mdRegular">
{text} <p>
{phoneContact?.phoneNumber ? ( {text}
<> {phoneContact?.phoneNumber ? (
<span> {phoneContact.displayText} </span> <>
<Link <span> {phoneContact.displayText} </span>
href={`tel:${phoneContact.phoneNumber.replace(/ /g, "")}`} <Link
> href={`tel:${phoneContact.phoneNumber.replace(/ /g, '')}`}
{phoneContact.phoneNumber} >
</Link> {phoneContact.phoneNumber}
{phoneContact.footnote ? ( </Link>
<> {phoneContact.footnote ? (
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} <>
<span>. ({phoneContact.footnote})</span> {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
</> <span>. ({phoneContact.footnote})</span>
) : null} </>
</> ) : null}
) : null} </>
</Body> ) : null}
</p>
</Typography>
) : null} ) : null}
</div> </div>

View File

@@ -1,28 +1,28 @@
import { import {
MaterialIcon, MaterialIcon,
type MaterialIconSetIconProps, type MaterialIconSetIconProps,
} from "@scandic-hotels/design-system/Icons/MaterialIcon" } from '../Icons/MaterialIcon'
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from '@scandic-hotels/common/constants/alert'
import type { JSX } from "react" import type { JSX } from 'react'
import type { AlertProps } from "./alert" import type { AlertProps } from './alert'
interface IconByAlertProps { interface IconByAlertProps {
alertType: AlertTypeEnum alertType: AlertTypeEnum
variant?: AlertProps["variant"] variant?: AlertProps['variant']
} }
export function IconByAlertType({ export function IconByAlertType({
alertType, alertType,
variant = "inline", variant = 'inline',
...props ...props
}: IconByAlertProps & MaterialIconSetIconProps): JSX.Element { }: IconByAlertProps & MaterialIconSetIconProps): JSX.Element {
switch (alertType) { switch (alertType) {
case AlertTypeEnum.Alarm: case AlertTypeEnum.Alarm:
return ( return (
<MaterialIcon <MaterialIcon
color={variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Error"} color={variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Error'}
isFilled isFilled
icon="error" icon="error"
{...props} {...props}
@@ -33,7 +33,7 @@ export function IconByAlertType({
<MaterialIcon <MaterialIcon
icon="warning" icon="warning"
color={ color={
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Warning" variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Warning'
} }
isFilled isFilled
{...props} {...props}
@@ -44,7 +44,7 @@ export function IconByAlertType({
<MaterialIcon <MaterialIcon
icon="check_circle" icon="check_circle"
color={ color={
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Success" variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Success'
} }
isFilled isFilled
{...props} {...props}
@@ -55,7 +55,7 @@ export function IconByAlertType({
return ( return (
<MaterialIcon <MaterialIcon
color={ color={
variant === "inline" ? "Icon/Inverted" : "Icon/Feedback/Information" variant === 'inline' ? 'Icon/Inverted' : 'Icon/Feedback/Information'
} }
isFilled isFilled
icon="info" icon="info"

View File

@@ -1,8 +1,8 @@
import { cva } from "class-variance-authority" import { cva } from 'class-variance-authority'
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert" import { AlertTypeEnum } from '@scandic-hotels/common/constants/alert'
import styles from "./alert.module.css" import styles from './alert.module.css'
export const alertVariants = cva(styles.alert, { export const alertVariants = cva(styles.alert, {
variants: { variants: {
@@ -18,7 +18,7 @@ export const alertVariants = cva(styles.alert, {
}, },
}, },
defaultVariants: { defaultVariants: {
variant: "inline", variant: 'inline',
type: AlertTypeEnum.Info, type: AlertTypeEnum.Info,
}, },
}) })

View File

@@ -6,6 +6,7 @@
"exports": { "exports": {
"./Accordion": "./lib/components/Accordion/index.tsx", "./Accordion": "./lib/components/Accordion/index.tsx",
"./Accordion/AccordionItem": "./lib/components/Accordion/AccordionItem/index.tsx", "./Accordion/AccordionItem": "./lib/components/Accordion/AccordionItem/index.tsx",
"./Alert": "./lib/components/Alert/index.tsx",
"./Avatar": "./lib/components/Avatar/index.tsx", "./Avatar": "./lib/components/Avatar/index.tsx",
"./BackToTopButton": "./lib/components/BackToTopButton/index.tsx", "./BackToTopButton": "./lib/components/BackToTopButton/index.tsx",
"./Body": "./lib/components/Body/index.tsx", "./Body": "./lib/components/Body/index.tsx",

View File

@@ -1,10 +1,13 @@
import { z, ZodError, ZodIssueCode } from "zod" import { z, ZodError, ZodIssueCode } from "zod"
import {
AlertTypeEnum,
AlertVisibleOnEnum,
} from "@scandic-hotels/common/constants/alert"
import { Lang } from "@scandic-hotels/common/constants/language" import { Lang } from "@scandic-hotels/common/constants/language"
import { logger } from "@scandic-hotels/common/logger" import { logger } from "@scandic-hotels/common/logger"
import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url"
import { AlertTypeEnum, AlertVisibleOnEnum } from "../../../types/alert"
import { discriminatedUnion } from "../../../utils/discriminatedUnion" import { discriminatedUnion } from "../../../utils/discriminatedUnion"
import { import {
cardBlockRefsSchema, cardBlockRefsSchema,

View File

@@ -1,10 +1,9 @@
import { z } from "zod" import { z } from "zod"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { dt } from "@scandic-hotels/common/dt" import { dt } from "@scandic-hotels/common/dt"
import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator"
import { AlertTypeEnum } from "../../../../types/alert"
const specialAlertSchema = z.object({ const specialAlertSchema = z.object({
description: nullableStringValidator, description: nullableStringValidator,
displayInBookingFlow: z.boolean().default(false), displayInBookingFlow: z.boolean().default(false),