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

@@ -1,8 +1,9 @@
import { notFound } from "next/navigation"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { dt } from "@scandic-hotels/common/dt"
import { Alert } from "@scandic-hotels/design-system/Alert"
import { Divider } from "@scandic-hotels/design-system/Divider"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
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 Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms"
import SidePanel from "@/components/HotelReservation/SidePanel"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n"
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"

View File

@@ -4,14 +4,14 @@ import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useRef, useState } from "react"
import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
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 { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { useEnterDetailsStore } from "@/stores/enter-details"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang"
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 styles from "./FnFNotAllowedAlert.module.css"

View File

@@ -1,13 +1,14 @@
import { useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
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 { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import Link from "@scandic-hotels/design-system/Link"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs"
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 MySavedCards from "@/components/HotelReservation/MySavedCards"
import PaymentOption from "@/components/HotelReservation/PaymentOption"
import Alert from "@/components/TempDesignSystem/Alert"
import useLang from "@/hooks/useLang"
import styles from "./confirmationStep.module.css"

View File

@@ -1,15 +1,15 @@
import { useFormContext } from "react-hook-form"
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 { ErrorMessage } from "@scandic-hotels/design-system/Form/ErrorMessage"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
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 Alert from "@/components/TempDesignSystem/Alert"
import Select from "@/components/TempDesignSystem/Form/Select"
import { getErrorMessage } from "@/utils/getErrorMessage"

View File

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

View File

@@ -1,12 +1,12 @@
"use client"
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 Modal from "@/components/HotelReservation/MyStay/Modal"
import Alert from "@/components/TempDesignSystem/Alert"
interface AlertsProps extends React.PropsWithChildren {
closeModal: () => void

View File

@@ -1,10 +1,10 @@
"use client"
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 Alert from "@/components/TempDesignSystem/Alert"
export default function CannotChangeDate({
closeModal,

View File

@@ -1,10 +1,10 @@
"use client"
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 Alert from "@/components/TempDesignSystem/Alert"
export default function MultiRoomBooking({
closeModal,

View File

@@ -1,10 +1,10 @@
"use client"
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 Alert from "@/components/TempDesignSystem/Alert"
export default function NotMainRoom({
closeModal,

View File

@@ -1,9 +1,8 @@
"use client"
import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
import { Alert } from "@scandic-hotels/design-system/Alert"
export default function NoAvailability() {
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 { 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 { getLang } from "@/i18n/serverContext"

View File

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

View File

@@ -1,5 +1,6 @@
import { dt } from "@scandic-hotels/common/dt"
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 { FacilityToIcon } from "@scandic-hotels/design-system/FacilityToIcon"
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 HotelDetailsSidePeek from "@/components/SidePeeks/HotelDetailsSidePeek"
import Alert from "@/components/TempDesignSystem/Alert"
import { getIntl } from "@/i18n"
import { mapApiImagesToGalleryImages } from "@/utils/imageGallery"

View File

@@ -1,11 +1,11 @@
"use client"
import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
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 { AlertTypeEnum } from "@scandic-hotels/trpc/types/alert"
import Alert from "@/components/TempDesignSystem/Alert"
import { useSelectRateContext } from "@/contexts/SelectRate/SelectRateContext"
import useLang from "@/hooks/useLang"

View File

@@ -3,9 +3,9 @@
import { TRPCClientError } from "@trpc/client"
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 { RateSummary } from "./RateSummary"

View File

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