diff --git a/apps/scandic-web/app/[lang]/(live)/layout.tsx b/apps/scandic-web/app/[lang]/(live)/layout.tsx index 6e2aff631..33b47d497 100644 --- a/apps/scandic-web/app/[lang]/(live)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(live)/layout.tsx @@ -11,6 +11,7 @@ import { NuqsAdapter } from "nuqs/adapters/next/app" import { BookingFlowTrackingProvider } from "@scandic-hotels/booking-flow/BookingFlowTrackingProvider" import { Lang } from "@scandic-hotels/common/constants/language" +import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" import TrpcProvider from "@/lib/trpc/Provider" @@ -22,7 +23,6 @@ import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCl import { RACRouterProvider } from "@/components/RACRouterProvider" import RouteChange from "@/components/RouteChange" import SitewideAlert from "@/components/SitewideAlert" -import { ToastHandler } from "@/components/TempDesignSystem/Toasts" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" import { UserExists } from "@/components/UserExists" diff --git a/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx b/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx index 1129a1112..39580997b 100644 --- a/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(no-layout)/layout.tsx @@ -10,6 +10,7 @@ import { SessionProvider } from "next-auth/react" import { NuqsAdapter } from "nuqs/adapters/next/app" import { Lang } from "@scandic-hotels/common/constants/language" +import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" import TrpcProvider from "@/lib/trpc/Provider" @@ -17,7 +18,6 @@ import { SessionRefresher } from "@/components/Auth/TokenRefresher" import CookieBotConsent from "@/components/CookieBot" import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import RouteChange from "@/components/RouteChange" -import { ToastHandler } from "@/components/TempDesignSystem/Toasts" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" import { getMessages } from "@/i18n" diff --git a/apps/scandic-web/app/[lang]/(partner)/layout.tsx b/apps/scandic-web/app/[lang]/(partner)/layout.tsx index 7ea3e0b89..b8788f34d 100644 --- a/apps/scandic-web/app/[lang]/(partner)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(partner)/layout.tsx @@ -9,6 +9,7 @@ import Script from "next/script" import { NuqsAdapter } from "nuqs/adapters/next/app" import { Lang } from "@scandic-hotels/common/constants/language" +import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" import TrpcProvider from "@/lib/trpc/Provider" @@ -16,7 +17,6 @@ import TokenRefresher from "@/components/Auth/TokenRefresher" import CookieBotConsent from "@/components/CookieBot" import StorageCleaner from "@/components/HotelReservation/EnterDetails/StorageCleaner" import RouteChange from "@/components/RouteChange" -import { ToastHandler } from "@/components/TempDesignSystem/Toasts" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" import { FontPreload } from "@/fonts/font-preloading" diff --git a/apps/scandic-web/app/[lang]/webview/layout.tsx b/apps/scandic-web/app/[lang]/webview/layout.tsx index c45097808..15b9ff488 100644 --- a/apps/scandic-web/app/[lang]/webview/layout.tsx +++ b/apps/scandic-web/app/[lang]/webview/layout.tsx @@ -8,11 +8,11 @@ import Script from "next/script" import { NuqsAdapter } from "nuqs/adapters/next/app" import { Lang } from "@scandic-hotels/common/constants/language" +import { ToastHandler } from "@scandic-hotels/design-system/ToastHandler" import TrpcProvider from "@/lib/trpc/Provider" import RouteChange from "@/components/RouteChange" -import { ToastHandler } from "@/components/TempDesignSystem/Toasts" import AdobeSDKScript from "@/components/TrackingSDK/AdobeSDKScript" import GTMScript from "@/components/TrackingSDK/GTMScript" import { FontPreload } from "@/fonts/font-preloading" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Buttons/CopyButton.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Buttons/CopyButton.tsx index 0fe1c5518..98b3d1283 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Buttons/CopyButton.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Buttons/CopyButton.tsx @@ -4,8 +4,7 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" - -import { toast } from "@/components/TempDesignSystem/Toasts" +import { toast } from "@scandic-hotels/design-system/Toast" import styles from "./copybutton.module.css" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx index fec692c0b..a19456889 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx @@ -7,8 +7,7 @@ import Caption from "@scandic-hotels/design-system/Caption" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Title from "@scandic-hotels/design-system/Title" - -import { toast } from "@/components/TempDesignSystem/Toasts" +import { toast } from "@scandic-hotels/design-system/Toast" import { RewardIcon } from "../../RewardIcon" diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/DestinationSearch/Form.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/DestinationSearch/Form.tsx index 9c426a459..9f495474f 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/DestinationSearch/Form.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/DestinationSearch/Form.tsx @@ -6,8 +6,7 @@ import { useIntl } from "react-intl" import { z } from "zod" import { Search } from "@scandic-hotels/booking-flow/BookingWidget/BookingWidgetForm/FormContent/Search" - -import { toast } from "@/components/TempDesignSystem/Toasts" +import { toast } from "@scandic-hotels/design-system/Toast" const destinationSearchFormSchema = z.object({ destinationSearch: z.string().min(1), diff --git a/apps/scandic-web/components/Forms/Edit/Profile/index.tsx b/apps/scandic-web/components/Forms/Edit/Profile/index.tsx index 421ba826a..0d025f2ef 100644 --- a/apps/scandic-web/components/Forms/Edit/Profile/index.tsx +++ b/apps/scandic-web/components/Forms/Edit/Profile/index.tsx @@ -9,6 +9,7 @@ import { profile } from "@scandic-hotels/common/constants/routes/myPages" import { logger } from "@scandic-hotels/common/logger" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Title from "@scandic-hotels/design-system/Title" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import { langToApiLang } from "@scandic-hotels/trpc/constants/apiLang" @@ -18,7 +19,6 @@ import { logout } from "@/constants/routes/handleAuth" import { editProfile } from "@/actions/editProfile" import Dialog from "@/components/Dialog" import ChangeNameDisclaimer from "@/components/MyPages/Profile/ChangeNameDisclaimer" -import { toast } from "@/components/TempDesignSystem/Toasts" import usePhoneNumberParsing from "@/hooks/usePhoneNumberParsing" import { formatPhoneNumber } from "@/utils/phone" diff --git a/apps/scandic-web/components/Forms/Signup/index.tsx b/apps/scandic-web/components/Forms/Signup/index.tsx index 867f539e9..617eff294 100644 --- a/apps/scandic-web/components/Forms/Signup/index.tsx +++ b/apps/scandic-web/components/Forms/Signup/index.tsx @@ -13,6 +13,7 @@ import CountrySelect from "@scandic-hotels/design-system/Form/Country" import DateSelect from "@scandic-hotels/design-system/Form/Date" import Phone from "@scandic-hotels/design-system/Form/Phone" import Link from "@scandic-hotels/design-system/Link" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" import { @@ -29,7 +30,6 @@ import { import Input from "@/components/TempDesignSystem/Form/Input" import PasswordInput from "@/components/TempDesignSystem/Form/PasswordInput" -import { toast } from "@/components/TempDesignSystem/Toasts" import { useFormTracking } from "@/components/TrackingSDK/hooks" import useLang from "@/hooks/useLang" import { getFormattedCountryList } from "@/utils/countries" diff --git a/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx b/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx index b6c01a77a..4f6c6c19d 100644 --- a/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx +++ b/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx @@ -4,8 +4,8 @@ import { useIntl } from "react-intl" import { dt } from "@scandic-hotels/common/dt" import { logger } from "@scandic-hotels/common/logger" +import { toast } from "@scandic-hotels/design-system/Toast" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import type { AddToCalendarProps } from "@/types/components/hotelReservation/bookingConfirmation/actions/addToCalendar" diff --git a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx index 61ecf28d4..7217315fe 100644 --- a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx @@ -12,12 +12,12 @@ import Caption from "@scandic-hotels/design-system/Caption" import Link from "@scandic-hotels/design-system/Link" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" import Title from "@scandic-hotels/design-system/Title" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import { customerService } from "@/constants/webHrefs" import Input from "@/components/TempDesignSystem/Form/Input" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import { type FindMyBookingFormSchema, findMyBookingFormSchema } from "./schema" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx index 43c28f083..976759c68 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx @@ -12,6 +12,7 @@ import { dt } from "@scandic-hotels/common/dt" import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import Modal from "@scandic-hotels/design-system/Modal" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" @@ -31,7 +32,6 @@ import { setAncillarySessionData, } from "@/components/HotelReservation/MyStay/utils/ancillaries" import LoadingSpinner from "@/components/LoadingSpinner" -import { toast } from "@/components/TempDesignSystem/Toasts" import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking" import useLang from "@/hooks/useLang" import { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/RemoveButton.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/RemoveButton.tsx index d86bb9207..13877684a 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/RemoveButton.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/RemoveButton.tsx @@ -3,10 +3,10 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import Dialog from "@/components/Dialog" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import { trackRemoveAncillary } from "@/utils/tracking/myStay" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/GuestDetails/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/GuestDetails/index.tsx index 8b41e4701..b7a5eed24 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/GuestDetails/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/GuestDetails/index.tsx @@ -11,13 +11,13 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import Modal from "@scandic-hotels/design-system/Modal" import { ModalContentWithActions } from "@scandic-hotels/design-system/Modal/ModalContentWithActions" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" import { isWebview } from "@/constants/routes/webviews" import MembershipLevelIcon from "@/components/Levels/Icon" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import ModifyContact from "../ModifyContact" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/FinalConfirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/FinalConfirmation/index.tsx index de65aa4c6..0edfc1b8c 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/FinalConfirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/FinalConfirmation/index.tsx @@ -3,13 +3,13 @@ import { differenceInCalendarDays } from "date-fns" import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import { trackCancelStay } from "@/utils/tracking" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx index 9e7f620b3..8688427a2 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx @@ -4,13 +4,13 @@ import { useIntl } from "react-intl" import { longDateWithYearFormat } from "@scandic-hotels/common/constants/dateFormats" import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" import PriceContainer from "@/components/HotelReservation/MyStay/ReferenceCard/PriceContainer" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import PriceAndDate from "./PriceAndDate" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx index 7fff9caa8..26135de86 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx @@ -4,11 +4,11 @@ import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" import { dt } from "@scandic-hotels/common/dt" +import { toast } from "@scandic-hotels/design-system/Toast" import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" -import { toast } from "@/components/TempDesignSystem/Toasts" import NoAvailability from "./Alerts/NoAvailability" import NewDates from "./NewDates" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx index 742f6ce64..4172a3c8f 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx @@ -9,6 +9,7 @@ import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting" import { Divider } from "@scandic-hotels/design-system/Divider" import Checkbox from "@scandic-hotels/design-system/Form/Checkbox" import Link from "@scandic-hotels/design-system/Link" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" @@ -20,7 +21,6 @@ import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Paym import MySavedCards from "@/components/HotelReservation/MySavedCards" import PaymentOption from "@/components/HotelReservation/PaymentOption" import LoadingSpinner from "@/components/LoadingSpinner" -import { toast } from "@/components/TempDesignSystem/Toasts" import { useGuaranteeBooking } from "@/hooks/booking/useGuaranteeBooking" import useLang from "@/hooks/useLang" import { trackGlaSaveCardAttempt } from "@/utils/tracking/myStay" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/AvailabilityError.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/AvailabilityError.tsx index a58096fc9..8c27f4120 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/AvailabilityError.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/AvailabilityError.tsx @@ -4,10 +4,9 @@ import { usePathname, useSearchParams } from "next/navigation" import { useEffect } from "react" import { useIntl } from "react-intl" +import { toast } from "@scandic-hotels/design-system/Toast" import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode" -import { toast } from "@/components/TempDesignSystem/Toasts" - export default function AvailabilityError() { const intl = useIntl() const pathname = usePathname() diff --git a/apps/scandic-web/components/MyPages/CopyMembershipIdButton/index.tsx b/apps/scandic-web/components/MyPages/CopyMembershipIdButton/index.tsx index 112e11673..30c1cd29c 100644 --- a/apps/scandic-web/components/MyPages/CopyMembershipIdButton/index.tsx +++ b/apps/scandic-web/components/MyPages/CopyMembershipIdButton/index.tsx @@ -4,10 +4,9 @@ import { useIntl } from "react-intl" import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" -import { toast } from "@/components/TempDesignSystem/Toasts" - import styles from "./copyMembershipIdButton.module.css" interface CopyMembershipIdButtonProps { diff --git a/apps/scandic-web/components/MyPages/SASLevelUpgradeCheck.tsx b/apps/scandic-web/components/MyPages/SASLevelUpgradeCheck.tsx index 6dcaa75ae..9049c9f20 100644 --- a/apps/scandic-web/components/MyPages/SASLevelUpgradeCheck.tsx +++ b/apps/scandic-web/components/MyPages/SASLevelUpgradeCheck.tsx @@ -6,11 +6,11 @@ import { useIntl } from "react-intl" import { partnerSas } from "@scandic-hotels/common/constants/routes/myPages" import { logger } from "@scandic-hotels/common/logger" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import { TIER_TO_FRIEND_MAP } from "@/constants/membershipLevels" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" export function SASLevelUpgradeCheck() { diff --git a/apps/scandic-web/components/MyPages/Surprises/Client.tsx b/apps/scandic-web/components/MyPages/Surprises/Client.tsx index 220b15825..655241be7 100644 --- a/apps/scandic-web/components/MyPages/Surprises/Client.tsx +++ b/apps/scandic-web/components/MyPages/Surprises/Client.tsx @@ -9,6 +9,7 @@ import { useIntl } from "react-intl" import { benefits } from "@scandic-hotels/common/constants/routes/myPages" import { logger } from "@scandic-hotels/common/logger" import Link from "@scandic-hotels/design-system/Link" +import { toast } from "@scandic-hotels/design-system/Toast" import { Typography } from "@scandic-hotels/design-system/Typography" import { trpc } from "@scandic-hotels/trpc/client" @@ -18,7 +19,6 @@ import { } from "@/constants/routes/webviews" import { customerService } from "@/constants/webHrefs" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import confetti from "./confetti" diff --git a/apps/scandic-web/components/Profile/AddCreditCardButton/index.tsx b/apps/scandic-web/components/Profile/AddCreditCardButton/index.tsx index 7c7f3c18c..bcaed8a2f 100644 --- a/apps/scandic-web/components/Profile/AddCreditCardButton/index.tsx +++ b/apps/scandic-web/components/Profile/AddCreditCardButton/index.tsx @@ -6,9 +6,9 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" -import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" import styles from "./addCreditCardButton.module.css" diff --git a/apps/scandic-web/components/Profile/DeleteCreditCardConfirmation.tsx b/apps/scandic-web/components/Profile/DeleteCreditCardConfirmation.tsx index 9ad64eeec..cad8a2da5 100644 --- a/apps/scandic-web/components/Profile/DeleteCreditCardConfirmation.tsx +++ b/apps/scandic-web/components/Profile/DeleteCreditCardConfirmation.tsx @@ -3,10 +3,10 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import Dialog from "@/components/Dialog" -import { toast } from "@/components/TempDesignSystem/Toasts" import type { DeleteCreditCardConfirmationProps } from "@/types/components/myPages/myProfile/creditCards" diff --git a/apps/scandic-web/components/Profile/ManagePreferencesButton/index.tsx b/apps/scandic-web/components/Profile/ManagePreferencesButton/index.tsx index f735e509f..4985f7a4c 100644 --- a/apps/scandic-web/components/Profile/ManagePreferencesButton/index.tsx +++ b/apps/scandic-web/components/Profile/ManagePreferencesButton/index.tsx @@ -4,10 +4,9 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" -import { toast } from "@/components/TempDesignSystem/Toasts" - import styles from "./managePreferencesButton.module.css" export default function ManagePreferencesButton() { diff --git a/apps/scandic-web/components/TempDesignSystem/Toasts/index.tsx b/apps/scandic-web/components/TempDesignSystem/Toasts/index.tsx deleted file mode 100644 index 9d5948d88..000000000 --- a/apps/scandic-web/components/TempDesignSystem/Toasts/index.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { type ExternalToast, toast as sonnerToast, Toaster } from "sonner" - -import Body from "@scandic-hotels/design-system/Body" -import { - MaterialIcon, - type MaterialIconSetIconProps, -} from "@scandic-hotels/design-system/Icons/MaterialIcon" -import { OldDSButton as Button } from "@scandic-hotels/design-system/OldDSButton" - -import { toastVariants } from "./variants" - -import styles from "./toasts.module.css" - -import type { ToastsProps } from "./toasts" - -export function ToastHandler() { - return -} - -interface AlertIconProps { - variant: ToastsProps["variant"] -} -function AlertIcon({ - variant, - ...props -}: AlertIconProps & MaterialIconSetIconProps) { - switch (variant) { - case "error": - return - case "info": - return - case "success": - return - case "warning": - return - } -} - -export function Toast({ children, message, onClose, variant }: ToastsProps) { - const className = toastVariants({ variant }) - const Icon = - return ( -
-
{Icon && Icon}
- {message ? ( - {message} - ) : ( -
{children}
- )} - {onClose ? ( - - ) : null} -
- ) -} - -export const toast = { - success: (message: React.ReactNode, options?: ExternalToast) => - sonnerToast.custom( - (t) => ( - sonnerToast.dismiss(t)} - /> - ), - options - ), - info: (message: React.ReactNode, options?: ExternalToast) => - sonnerToast.custom( - (t) => ( - sonnerToast.dismiss(t)} - /> - ), - options - ), - error: (message: React.ReactNode, options?: ExternalToast) => - sonnerToast.custom( - (t) => ( - sonnerToast.dismiss(t)} - /> - ), - options - ), - warning: (message: React.ReactNode, options?: ExternalToast) => - sonnerToast.custom( - (t) => ( - sonnerToast.dismiss(t)} - /> - ), - options - ), -} diff --git a/apps/scandic-web/components/TempDesignSystem/Toasts/toasts.ts b/apps/scandic-web/components/TempDesignSystem/Toasts/toasts.ts deleted file mode 100644 index b18aedbad..000000000 --- a/apps/scandic-web/components/TempDesignSystem/Toasts/toasts.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { VariantProps } from "class-variance-authority" - -import type { toastVariants } from "./variants" - -export type ToastsProps = Omit, "color"> & - VariantProps & { - onClose?: () => void - } & ( - | { - children: React.ReactNode - message?: never - } - | { - children?: never - message: React.ReactNode - } - ) diff --git a/apps/scandic-web/components/TempDesignSystem/Toasts/variants.ts b/apps/scandic-web/components/TempDesignSystem/Toasts/variants.ts deleted file mode 100644 index a215edc77..000000000 --- a/apps/scandic-web/components/TempDesignSystem/Toasts/variants.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { cva } from "class-variance-authority" - -import styles from "./toasts.module.css" - -export const toastVariants = cva(styles.toast, { - variants: { - variant: { - success: styles.success, - info: styles.info, - warning: styles.warning, - error: styles.error, - }, - }, -}) diff --git a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts index 365aade76..b314390f2 100644 --- a/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts +++ b/apps/scandic-web/hooks/booking/useGuaranteeBooking.ts @@ -3,10 +3,10 @@ import { useCallback, useEffect, useState } from "react" import { useIntl } from "react-intl" import { trackEvent } from "@scandic-hotels/common/tracking/base" +import { toast } from "@scandic-hotels/design-system/Toast" import { trpc } from "@scandic-hotels/trpc/client" import { BookingStatusEnum } from "@scandic-hotels/trpc/enums/bookingStatus" -import { toast } from "@/components/TempDesignSystem/Toasts" import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus" const maxRetries = 15 diff --git a/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts b/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts index 147bd1e09..79b1ab772 100644 --- a/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts +++ b/apps/scandic-web/hooks/booking/useGuaranteePaymentFailedToast.ts @@ -4,10 +4,9 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation" import { useCallback, useEffect } from "react" import { useIntl } from "react-intl" +import { toast } from "@scandic-hotels/design-system/Toast" import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode" -import { toast } from "@/components/TempDesignSystem/Toasts" - export function useGuaranteePaymentFailedToast() { const intl = useIntl() const searchParams = useSearchParams() diff --git a/apps/scandic-web/package.json b/apps/scandic-web/package.json index 92904a218..d96b8309a 100644 --- a/apps/scandic-web/package.json +++ b/apps/scandic-web/package.json @@ -93,7 +93,6 @@ "react-intl": "^7.1.11", "react-to-print": "^3.1.0", "server-only": "^0.0.1", - "sonner": "^2.0.3", "supercluster": "^8.0.1", "usehooks-ts": "3.1.1", "zod": "^3.24.4", diff --git a/packages/design-system/lib/components/Toasts/Toast.stories.tsx b/packages/design-system/lib/components/Toasts/Toast.stories.tsx new file mode 100644 index 000000000..1da9a68e7 --- /dev/null +++ b/packages/design-system/lib/components/Toasts/Toast.stories.tsx @@ -0,0 +1,93 @@ +import { Toast } from './Toast' + +import type { Meta, StoryObj } from '@storybook/nextjs-vite' +import { expect } from 'storybook/test' + +import { config } from './variants.ts' + +const meta: Meta = { + title: 'Components/Toasts/Toast', + component: Toast, + argTypes: { + variant: { + control: 'select', + type: 'string', + options: Object.keys(config.variants.variant), + table: { + defaultValue: { summary: 'info' }, + }, + }, + message: { + control: 'text', + type: 'string', + table: { + defaultValue: { summary: 'Toast message' }, + }, + }, + }, +} + +export default meta + +type Story = StoryObj + +export const Default: Story = { + args: { + variant: 'info', + message: 'This is a toast', + }, + play: async ({ canvas }) => { + const toast = await canvas.findByRole('status') + expect(toast).toBeVisible() + }, +} + +export const DefaultWithCustomContent: Story = { + args: { + variant: 'info', + children: ( +

This is a custom info toast

+ ), + }, + play: async ({ canvas }) => { + const toast = await canvas.findByRole('status') + expect(toast).toBeVisible() + expect(canvas.getByText('This is a custom info toast')).toBeVisible() + }, +} + +export const Success: Story = { + args: { + variant: 'success', + message: 'This is a success toast', + }, + play: async ({ canvas, args }) => { + const toast = await canvas.findByRole('status') + expect(toast).toBeVisible() + expect(canvas.getByText(args.message as string)).toBeVisible() + }, +} + +export const Error: Story = { + args: { + variant: 'error', + message: 'This is an error toast', + }, + play: async ({ canvas, args }) => { + const toast = await canvas.findByRole('alert') + expect(toast).toBeVisible() + expect(canvas.getByText(args.message as string)).toBeVisible() + }, +} + +export const Warning: Story = { + args: { + variant: 'warning', + message: 'This is a warning toast', + }, + play: async ({ canvas, args }) => { + const toast = await canvas.findByRole('alert') + expect(toast).toBeVisible() + expect(canvas.getByText(args.message as string)).toBeVisible() + }, +} diff --git a/packages/design-system/lib/components/Toasts/Toast.tsx b/packages/design-system/lib/components/Toasts/Toast.tsx new file mode 100644 index 000000000..d6385bab1 --- /dev/null +++ b/packages/design-system/lib/components/Toasts/Toast.tsx @@ -0,0 +1,84 @@ +import type { VariantProps } from 'class-variance-authority' + +import { toastVariants } from './variants' +import { MaterialIcon, MaterialIconSetIconProps } from '../Icons/MaterialIcon' + +import styles from './toasts.module.css' +import { Typography } from '../Typography' +import { useIntl } from 'react-intl' +import { IconButton } from '../IconButton' + +export type ToastsProps = VariantProps & { + variant: NonNullable['variant']> + onClose?: () => void +} & ( + | { + children: React.ReactNode + message?: never + } + | { + children?: never + message: React.ReactNode + } + ) + +export function Toast({ children, message, onClose, variant }: ToastsProps) { + const className = toastVariants({ variant }) + const intl = useIntl() + const Icon = + + return ( +
+
{Icon && Icon}
+ {message ? ( + +

{message}

+
+ ) : ( +
{children}
+ )} + {onClose ? ( + + + + ) : null} +
+ ) +} + +interface AlertIconProps { + variant: ToastsProps['variant'] +} +function AlertIcon({ + variant, + ...props +}: AlertIconProps & MaterialIconSetIconProps) { + switch (variant) { + case 'error': + return + case 'info': + return + case 'success': + return + case 'warning': + return + } +} + +function getRole(variant: ToastsProps['variant']) { + switch (variant) { + case 'error': + case 'warning': + return 'alert' + case 'info': + case 'success': + default: + return 'status' + } +} diff --git a/packages/design-system/lib/components/Toasts/ToastHandler.stories.tsx b/packages/design-system/lib/components/Toasts/ToastHandler.stories.tsx new file mode 100644 index 000000000..87e8f963c --- /dev/null +++ b/packages/design-system/lib/components/Toasts/ToastHandler.stories.tsx @@ -0,0 +1,87 @@ +import { toast } from './index.tsx' +import { Toast } from './Toast.tsx' + +import type { Meta, StoryObj } from '@storybook/nextjs-vite' + +import { config } from './variants.ts' +import { ToastHandler } from './ToastHandler.tsx' +import { Button } from '../Button/Button.tsx' +import { expect, waitFor } from 'storybook/test' + +const meta: Meta = { + title: 'Components/Toasts/ToastHandler', + component: Toast, + argTypes: { + variant: { + control: 'select', + type: 'string', + options: Object.keys(config.variants.variant), + table: { + defaultValue: { summary: 'info' }, + }, + }, + message: { + control: 'text', + type: 'string', + table: { + defaultValue: { summary: 'Toast message' }, + }, + }, + }, +} + +export default meta + +type Story = StoryObj + +export const Default: Story = { + args: { + variant: 'info', + message: 'This is a toast', + }, + render: (args) => { + return + }, + + play: async ({ canvas, userEvent, args }) => { + let toast = canvas.queryByRole('status') + expect(toast).not.toBeInTheDocument() + + const showToastButton = await canvas.findByRole('button') + await userEvent.click(showToastButton) + + toast = await canvas.findByRole( + ['info', 'success'].indexOf(args.variant) !== -1 ? 'status' : 'alert' + ) + await waitFor(async () => await expect(toast).toBeVisible()) + + const closeButton = await canvas.findByLabelText('Dismiss notification') + await userEvent.click(closeButton) + + await waitFor(async () => await expect(toast).not.toBeVisible()) + }, +} + +const Renderer = ({ + message, + variant, +}: { + message: string + variant: 'info' | 'success' | 'warning' | 'error' + onDismiss?: () => void +}) => { + const text = 'Show Toast' + return ( + <> + + + + ) +} diff --git a/packages/design-system/lib/components/Toasts/ToastHandler.tsx b/packages/design-system/lib/components/Toasts/ToastHandler.tsx new file mode 100644 index 000000000..0935440b6 --- /dev/null +++ b/packages/design-system/lib/components/Toasts/ToastHandler.tsx @@ -0,0 +1,5 @@ +import { Toaster } from 'sonner' + +export function ToastHandler() { + return +} diff --git a/packages/design-system/lib/components/Toasts/index.tsx b/packages/design-system/lib/components/Toasts/index.tsx new file mode 100644 index 000000000..4a749b8a6 --- /dev/null +++ b/packages/design-system/lib/components/Toasts/index.tsx @@ -0,0 +1,49 @@ +import { type ExternalToast, toast as sonnerToast } from 'sonner' +import { Toast } from './Toast' + +export const toast = { + success: (message: React.ReactNode, options?: ExternalToast) => + sonnerToast.custom( + (t) => ( + sonnerToast.dismiss(t)} + /> + ), + options + ), + info: (message: React.ReactNode, options?: ExternalToast) => + sonnerToast.custom( + (t) => ( + sonnerToast.dismiss(t)} + /> + ), + options + ), + error: (message: React.ReactNode, options?: ExternalToast) => + sonnerToast.custom( + (t) => ( + sonnerToast.dismiss(t)} + /> + ), + options + ), + warning: (message: React.ReactNode, options?: ExternalToast) => + sonnerToast.custom( + (t) => ( + sonnerToast.dismiss(t)} + /> + ), + options + ), +} diff --git a/apps/scandic-web/components/TempDesignSystem/Toasts/toasts.module.css b/packages/design-system/lib/components/Toasts/toasts.module.css similarity index 100% rename from apps/scandic-web/components/TempDesignSystem/Toasts/toasts.module.css rename to packages/design-system/lib/components/Toasts/toasts.module.css diff --git a/packages/design-system/lib/components/Toasts/variants.ts b/packages/design-system/lib/components/Toasts/variants.ts new file mode 100644 index 000000000..aae0280a1 --- /dev/null +++ b/packages/design-system/lib/components/Toasts/variants.ts @@ -0,0 +1,16 @@ +import { cva } from 'class-variance-authority' + +import styles from './toasts.module.css' + +export const config = { + variants: { + variant: { + success: styles.success, + info: styles.info, + warning: styles.warning, + error: styles.error, + }, + }, +} as const + +export const toastVariants = cva(styles.toast, config) diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 0c268c126..53124d8c0 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -154,6 +154,8 @@ "./Table": "./lib/components/Table/index.tsx", "./Title": "./lib/components/Title/index.tsx", "./Tooltip": "./lib/components/Tooltip/index.tsx", + "./Toast": "./lib/components/Toasts/index.tsx", + "./ToastHandler": "./lib/components/Toasts/ToastHandler.tsx", "./TripAdvisorChip": "./lib/components/TripAdvisorChip/index.tsx", "./Typography": "./lib/components/Typography/index.tsx", "./JsonToHtml": "./lib/components/JsonToHtml/JsonToHtml.tsx", @@ -196,7 +198,8 @@ "test:browser": "vitest --config=vitest.browser.config.ts" }, "dependencies": { - "@scandic-hotels/common": "workspace:*" + "@scandic-hotels/common": "workspace:*", + "sonner": "^2.0.3" }, "peerDependencies": { "@babel/core": "^7.27.4", diff --git a/yarn.lock b/yarn.lock index 252bea92c..809b99588 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6212,6 +6212,7 @@ __metadata: react-dom: "npm:^19.1.0" rollup: "npm:^4.40.2" rollup-preserve-directives: "npm:^1.1.3" + sonner: "npm:^2.0.3" storybook: "npm:^9.1.2" storybook-react-intl: "npm:^4.0.7" typescript: "npm:^5.8.3" @@ -6422,7 +6423,6 @@ __metadata: react-to-print: "npm:^3.1.0" schema-dts: "npm:^1.1.5" server-only: "npm:^0.0.1" - sonner: "npm:^2.0.3" start-server-and-test: "npm:^2.0.11" supercluster: "npm:^8.0.1" ts-morph: "npm:^25.0.1"