Merged in feat/sw-2864-move-hotels-router-to-trpc-package (pull request #2410)
feat (SW-2864): Move booking router to trpc package * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * WIP first step * update internal imports in trpc * Fix most errors in scandic-web Just 100 left... * Move Props type out of trpc * Fix CategorizedFilters types * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Move booking router to trpc package * Merge branch 'master' into feat/sw-2864-move-hotels-router-to-trpc-package Approved-by: Linus Flood
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { getFriendsMembership } from "@scandic-hotels/trpc/routers/user/helpers"
|
||||
|
||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { getFriendsMembership } from "@/utils/user"
|
||||
|
||||
import type { UserProps } from "@/types/components/myPages/user"
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels"
|
||||
import { getFriendsMembership } from "@scandic-hotels/trpc/routers/user/helpers"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getFriendsMembership } from "@/utils/user"
|
||||
|
||||
import PointsContainer from "./Container"
|
||||
import { PointsColumn } from "./PointsColumn"
|
||||
|
||||
@@ -23,7 +23,7 @@ import { UnlinkSAS } from "./UnlinkSAS"
|
||||
|
||||
import styles from "./linkedAccounts.module.css"
|
||||
|
||||
import type { UserLoyalty } from "@/types/user"
|
||||
import type { UserLoyalty } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
type Props = {
|
||||
title?: string
|
||||
|
||||
@@ -7,8 +7,8 @@ import { FormProvider, useForm } from "react-hook-form"
|
||||
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
import { StickyElementNameEnum } from "@/stores/sticky-position"
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import { useMediaQuery } from "usehooks-ts"
|
||||
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import Modal from "@/components/Modal"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
|
||||
@@ -7,8 +7,7 @@ import { useMediaQuery } from "usehooks-ts"
|
||||
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import Modal from "@/components/Modal"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
|
||||
@@ -7,8 +7,8 @@ import { useIntl } from "react-intl"
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { hotelreservation } from "@/constants/routes/hotelReservation"
|
||||
|
||||
import DatePicker from "@/components/DatePicker"
|
||||
|
||||
@@ -5,11 +5,12 @@ import { useTransition } from "react"
|
||||
import { Form as FormRAC } from "react-aria-components"
|
||||
import { useFormContext } from "react-hook-form"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import {
|
||||
selectHotel,
|
||||
selectHotelMap,
|
||||
selectRate,
|
||||
} from "@/constants/routes/hotelReservation"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
|
||||
export const bookingWidgetErrors = {
|
||||
AGE_REQUIRED: "AGE_REQUIRED",
|
||||
BED_CHOICE_REQUIRED: "BED_CHOICE_REQUIRED",
|
||||
|
||||
@@ -6,8 +6,7 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import Button from "../TempDesignSystem/Button"
|
||||
import { Tooltip } from "../TempDesignSystem/Tooltip"
|
||||
|
||||
@@ -20,9 +20,9 @@ import MyPagesMenuContent, { useMyPagesNavigation } from "../MyPagesMenuContent"
|
||||
import styles from "./myPagesMenu.module.css"
|
||||
|
||||
import type { LoyaltyLevel } from "@scandic-hotels/trpc/routers/contentstack/loyaltyLevel/output"
|
||||
import type { FriendsMembership, User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown"
|
||||
import type { FriendsMembership, User } from "@/types/user"
|
||||
|
||||
export type MyPagesMenuProps = {
|
||||
user: Pick<User, "firstName" | "lastName">
|
||||
|
||||
@@ -6,8 +6,9 @@ import {
|
||||
packageSchema,
|
||||
} from "@scandic-hotels/trpc/routers/hotels/schemas/packages"
|
||||
|
||||
import type { Package } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import type { Package } from "@/types/requests/packages"
|
||||
import type { Room } from "@/types/stores/booking-confirmation"
|
||||
|
||||
export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
|
||||
@@ -4,11 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
import { FormProvider, useForm } from "react-hook-form"
|
||||
|
||||
import {
|
||||
BED_TYPE_ICONS,
|
||||
type BedTypeEnum,
|
||||
type ExtraBedTypeEnum,
|
||||
} from "@/constants/booking"
|
||||
import { BED_TYPE_ICONS } from "@/constants/booking"
|
||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||
|
||||
import RadioCard from "@/components/TempDesignSystem/Form/RadioCard"
|
||||
@@ -20,6 +16,10 @@ import { bedTypeFormSchema } from "./schema"
|
||||
import styles from "./bedOptions.module.css"
|
||||
|
||||
import type { IconProps } from "@scandic-hotels/design-system/Icons"
|
||||
import type {
|
||||
BedTypeEnum,
|
||||
ExtraBedTypeEnum,
|
||||
} from "@scandic-hotels/trpc/enums/bedType"
|
||||
|
||||
import type { BedTypeFormSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import PaymentOptionsGroup from "../../Payment/PaymentOptionsGroup"
|
||||
|
||||
import styles from "./guarantee.module.css"
|
||||
|
||||
import type { CreditCard } from "@/types/user"
|
||||
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface GuaranteeProps {
|
||||
savedCreditCards: CreditCard[] | null
|
||||
|
||||
@@ -11,7 +11,7 @@ import Guarantee from "./Guarantee"
|
||||
|
||||
import styles from "./confirm.module.css"
|
||||
|
||||
import type { CreditCard } from "@/types/user"
|
||||
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface ConfirmBookingProps {
|
||||
savedCreditCards: CreditCard[] | null
|
||||
|
||||
@@ -4,10 +4,10 @@ import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
|
||||
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
|
||||
|
||||
import { BookingErrorCodeEnum } from "@/constants/booking"
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||
|
||||
import Alert from "@/components/TempDesignSystem/Alert"
|
||||
|
||||
@@ -9,19 +9,15 @@ import { FormProvider, useForm } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { Button } from "@scandic-hotels/design-system/Button"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { bedTypeMap } from "@scandic-hotels/trpc/constants/bedTypeMap"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import {
|
||||
BookingStatusEnum,
|
||||
PAYMENT_METHOD_TITLES,
|
||||
REDEMPTION,
|
||||
} from "@/constants/booking"
|
||||
import {
|
||||
bookingConfirmation,
|
||||
selectRate,
|
||||
} from "@/constants/routes/hotelReservation"
|
||||
import { BookingStatusEnum, PAYMENT_METHOD_TITLES } from "@/constants/booking"
|
||||
import { bookingConfirmation } from "@/constants/routes/hotelReservation"
|
||||
import { env } from "@/env/client"
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||
@@ -38,7 +34,6 @@ import { trackPaymentEvent } from "@/utils/tracking"
|
||||
import { trackEvent } from "@/utils/tracking/base"
|
||||
import { trackGlaSaveCardAttempt } from "@/utils/tracking/myStay"
|
||||
|
||||
import { bedTypeMap } from "../../utils"
|
||||
import ConfirmBooking, { ConfirmBookingRedemption } from "../Confirm"
|
||||
import PriceChangeDialog from "../PriceChangeDialog"
|
||||
import { writeGlaToSessionStorage } from "./PaymentCallback/helpers"
|
||||
|
||||
@@ -4,10 +4,10 @@ import { useRouter } from "next/navigation"
|
||||
import { useTransition } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { Button } from "@scandic-hotels/design-system/Button"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||
|
||||
import Footnote from "@/components/TempDesignSystem/Text/Footnote"
|
||||
|
||||
@@ -9,9 +9,9 @@ import { getTracking } from "./tracking"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
|
||||
import type { Room } from "@scandic-hotels/trpc/types/room"
|
||||
|
||||
import type { DetailsBooking } from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import type { Room } from "@/types/providers/details/room"
|
||||
|
||||
interface TrackingWrapperProps {
|
||||
booking: DetailsBooking
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { differenceInCalendarDays, format, isWeekend } from "date-fns"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||
import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages"
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
|
||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
||||
import { getSpecialRoomType } from "@/utils/specialRoomType"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
|
||||
import type { Room } from "@scandic-hotels/trpc/types/room"
|
||||
import type {
|
||||
PriceProduct,
|
||||
Product,
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
type TrackingSDKHotelInfo,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type { Room } from "@/types/providers/details/room"
|
||||
import type { RoomState } from "@/types/stores/enter-details"
|
||||
|
||||
export function getTracking(
|
||||
|
||||
@@ -7,7 +7,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
|
||||
import styles from "./hotelChequeCard.module.css"
|
||||
|
||||
import type { ProductTypeCheque } from "@/types/trpc/routers/hotel/availability"
|
||||
import type { ProductTypeCheque } from "@scandic-hotels/trpc/types/availability"
|
||||
|
||||
export default function HotelChequeCard({
|
||||
productTypeCheque,
|
||||
|
||||
@@ -7,7 +7,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
|
||||
import styles from "./hotelVoucherCard.module.css"
|
||||
|
||||
import type { ProductTypeVoucher } from "@/types/trpc/routers/hotel/availability"
|
||||
import type { ProductTypeVoucher } from "@scandic-hotels/trpc/types/availability"
|
||||
|
||||
export default function HotelVoucherCard({
|
||||
productTypeVoucher,
|
||||
|
||||
@@ -10,11 +10,12 @@ import {
|
||||
import { memo } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||
import HotelLogoIcon from "@scandic-hotels/design-system/Icons/HotelLogoIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { selectHotelMap, selectRate } from "@/constants/routes/hotelReservation"
|
||||
import { selectHotelMap } from "@/constants/routes/hotelReservation"
|
||||
import { useHotelsMapStore } from "@/stores/hotels-map"
|
||||
|
||||
import BookingCodeChip from "@/components/BookingCodeChip"
|
||||
|
||||
@@ -3,12 +3,11 @@ import { useSession } from "next-auth/react"
|
||||
import { useState } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
|
||||
import { FacilityToIcon } from "@/components/ContentType/HotelPage/data"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
|
||||
@@ -3,12 +3,11 @@ import { useSession } from "next-auth/react"
|
||||
import { useState } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation"
|
||||
import { IconButton } from "@scandic-hotels/design-system/IconButton"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
|
||||
import { FacilityToIcon } from "@/components/ContentType/HotelPage/data"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
|
||||
@@ -8,8 +8,7 @@ import PaymentOption from "../PaymentOption"
|
||||
import styles from "./mySavedCards.module.css"
|
||||
|
||||
import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"
|
||||
|
||||
import type { CreditCard } from "@/types/user"
|
||||
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface MySavedCardsProps {
|
||||
savedCreditCards: CreditCard[] | null
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
import type {
|
||||
Ancillaries,
|
||||
Ancillary,
|
||||
SelectedAncillary,
|
||||
} from "@/types/components/myPages/myStay/ancillaries"
|
||||
import type { User } from "@/types/user"
|
||||
|
||||
function filterPoints(ancillaries: Ancillaries, user: User | null) {
|
||||
return ancillaries.map((ancillary) => {
|
||||
|
||||
@@ -7,8 +7,9 @@ import BoldRow from "./Row/Bold"
|
||||
import RegularRow from "./Row/Regular"
|
||||
import Tbody from "./Tbody"
|
||||
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
|
||||
interface BreakfastProps {
|
||||
adults: number
|
||||
|
||||
@@ -5,7 +5,7 @@ import { formatPrice } from "@/utils/numberFormatting"
|
||||
|
||||
import RegularRow from "../Regular"
|
||||
|
||||
import type { Packages as PackagesType } from "@/types/requests/packages"
|
||||
import type { Packages as PackagesType } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
interface PackagesProps {
|
||||
packages: PackagesType | null
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
export interface SharedPriceRowProps {
|
||||
bedType: BedTypeSchema | undefined
|
||||
|
||||
@@ -27,13 +27,13 @@ import Tbody from "./Tbody"
|
||||
import styles from "./priceDetailsTable.module.css"
|
||||
|
||||
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { RateDefinition } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import type { Price } from "@/types/components/hotelReservation/price"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
type RoomPrice =
|
||||
| CorporateChequePriceType
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel"
|
||||
import { generateChildrenString } from "@scandic-hotels/trpc/routers/hotels/helpers"
|
||||
import {
|
||||
type AdditionalData,
|
||||
type Hotel,
|
||||
} from "@scandic-hotels/trpc/types/hotel"
|
||||
import {
|
||||
type HotelLocation,
|
||||
type Location,
|
||||
} from "@scandic-hotels/trpc/types/locations"
|
||||
|
||||
import { getHotel } from "@/lib/trpc/memoizedRequests"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import { generateChildrenString } from "../utils"
|
||||
|
||||
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
|
||||
import type {
|
||||
HotelLocation,
|
||||
Location,
|
||||
} from "@scandic-hotels/trpc/types/locations"
|
||||
import type { HotelsAvailabilityItem } from "@scandic-hotels/trpc/types/availability"
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
|
||||
import type {
|
||||
AlternativeHotelsAvailabilityInput,
|
||||
@@ -21,8 +25,6 @@ import type {
|
||||
CategorizedHotelFilters,
|
||||
HotelFilter,
|
||||
} from "@/types/components/hotelReservation/selectHotel/hotelFilters"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { HotelsAvailabilityItem } from "@/types/trpc/routers/hotel/availability"
|
||||
|
||||
interface AvailabilityResponse {
|
||||
availability: HotelsAvailabilityItem[]
|
||||
|
||||
@@ -4,7 +4,7 @@ import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { useEffect } from "react"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { BookingErrorCodeEnum } from "@/constants/booking"
|
||||
import { BookingErrorCodeEnum } from "@scandic-hotels/trpc/enums/bookingErrorCode"
|
||||
|
||||
import { toast } from "@/components/TempDesignSystem/Toasts"
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@ import { getMemberPrice, isBookingCodeRate } from "../utils"
|
||||
|
||||
import styles from "./room.module.css"
|
||||
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type {
|
||||
RoomPrice,
|
||||
RoomRate,
|
||||
} from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
interface RoomProps {
|
||||
room: {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { Price } from "@/types/components/hotelReservation/price"
|
||||
import type {
|
||||
Rate,
|
||||
Room,
|
||||
} from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
export function mapRate(
|
||||
room: Rate,
|
||||
|
||||
@@ -3,11 +3,11 @@ import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType"
|
||||
|
||||
import { sumPackages } from "@/components/HotelReservation/utils"
|
||||
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability"
|
||||
|
||||
import type { Price } from "@/types/components/hotelReservation/price"
|
||||
import type { Rate } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
export function calculateTotalPrice(
|
||||
selectedRateSummary: Rate[],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
export function includesAllergyRoom(codes: PackageEnum[]) {
|
||||
return codes.includes(RoomPackageCodeEnum.ALLERGY_ROOM)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
export type FormValues = {
|
||||
selectedPackages: PackageEnum[]
|
||||
|
||||
@@ -16,7 +16,8 @@ import Checkboxes from "./Checkboxes"
|
||||
|
||||
import styles from "./form.module.css"
|
||||
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { FormValues } from "./formValues"
|
||||
|
||||
export default function Form({ close }: { close: () => void }) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import { getIconNameByPackageCode } from "./utils"
|
||||
|
||||
import styles from "./roomPackageFilter.module.css"
|
||||
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
export default function RoomPackageFilter() {
|
||||
const lang = useLang()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import type { MaterialSymbolProps } from "@scandic-hotels/design-system/Icons/MaterialIcon/MaterialSymbol"
|
||||
|
||||
import type { PackageEnum } from "@/types/requests/packages"
|
||||
import type { PackageEnum } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
export function getIconNameByPackageCode(
|
||||
packageCode: PackageEnum
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import React from "react"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking"
|
||||
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
export function convertToChildType(
|
||||
|
||||
@@ -6,14 +6,10 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||
import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum"
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { JSX } from "react"
|
||||
|
||||
import {
|
||||
// RoomPackageCodeEnum,
|
||||
type RoomPackageCodes,
|
||||
} from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import { type RoomPackageCodes } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
|
||||
interface IconForFeatureCodeProps {
|
||||
featureCode: RoomPackageCodes
|
||||
@@ -33,13 +29,6 @@ export function IconForFeatureCode({
|
||||
}
|
||||
}
|
||||
|
||||
export const bedTypeMap: Record<number, ChildBedTypeEnum> = {
|
||||
[ChildBedMapEnum.IN_ADULTS_BED]: ChildBedTypeEnum.ParentsBed,
|
||||
[ChildBedMapEnum.IN_CRIB]: ChildBedTypeEnum.Crib,
|
||||
[ChildBedMapEnum.IN_EXTRA_BED]: ChildBedTypeEnum.ExtraBed,
|
||||
[ChildBedMapEnum.UNKNOWN]: ChildBedTypeEnum.Unknown,
|
||||
}
|
||||
|
||||
export const invertedBedTypeMap: Record<ChildBedTypeEnum, string> = {
|
||||
[ChildBedTypeEnum.ParentsBed]: ChildBedMapEnum[ChildBedMapEnum.IN_ADULTS_BED],
|
||||
[ChildBedTypeEnum.Crib]: ChildBedMapEnum[ChildBedMapEnum.IN_CRIB],
|
||||
@@ -47,16 +36,6 @@ export const invertedBedTypeMap: Record<ChildBedTypeEnum, string> = {
|
||||
[ChildBedTypeEnum.Unknown]: ChildBedMapEnum[ChildBedMapEnum.UNKNOWN],
|
||||
}
|
||||
|
||||
export function generateChildrenString(children: Child[]): string {
|
||||
return `[${children
|
||||
.map((child) => {
|
||||
const age = child.age
|
||||
const bedType = bedTypeMap[parseInt(child.bed.toString())]
|
||||
return `${age}:${bedType}`
|
||||
})
|
||||
.join(",")}]`
|
||||
}
|
||||
|
||||
export function sumPackages(packages: Packages | null) {
|
||||
if (!packages || !packages.length) {
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getInitials } from "@/utils/user"
|
||||
|
||||
import styles from "./avatar.module.css"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
import type { User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
export default function Avatar({
|
||||
firstName,
|
||||
|
||||
@@ -15,7 +15,7 @@ import DigitalTeamMemberCardContent from "./Content"
|
||||
|
||||
import styles from "./digitalTeamMemberCard.module.css"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
import type { User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface DigitalTeamMemberCardClientProps {
|
||||
user: User
|
||||
|
||||
@@ -9,7 +9,7 @@ import { debounce } from "@/utils/debounce"
|
||||
|
||||
import styles from "./digitalTeamMemberCard.module.css"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
import type { User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface DigitalTeamMemberCardCardProps {
|
||||
user: User
|
||||
|
||||
@@ -2,7 +2,7 @@ import { env } from "@/env/server"
|
||||
|
||||
import DigitalTeamMemberCardClient from "./Client"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
import type { User } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
interface DigitalTeamMemberCardProps {
|
||||
user: User
|
||||
|
||||
@@ -3,8 +3,8 @@ import { isValidLang } from "@scandic-hotels/common/utils/languages"
|
||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
import { countriesMap } from "@scandic-hotels/trpc/constants/countries"
|
||||
|
||||
import { countriesMap } from "@/constants/countries"
|
||||
import { languages } from "@/constants/languages"
|
||||
import { profileEdit } from "@/constants/routes/myPages"
|
||||
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
@@ -8,7 +8,7 @@ import CreditCardRow from "../CreditCardRow"
|
||||
|
||||
import styles from "./CreditCardList.module.css"
|
||||
|
||||
import type { CreditCard } from "@/types/user"
|
||||
import type { CreditCard } from "@scandic-hotels/trpc/types/user"
|
||||
|
||||
export default function CreditCardList({
|
||||
initialData,
|
||||
|
||||
@@ -25,13 +25,13 @@ import RoomDetails from "./RoomDetails"
|
||||
|
||||
import styles from "./bookedRoomSidePeek.module.css"
|
||||
|
||||
import type { Child } from "@scandic-hotels/trpc/types/child"
|
||||
import type { Room as HotelRoom } from "@scandic-hotels/trpc/types/hotel"
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDetails/bedType"
|
||||
import type { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation"
|
||||
import type { SafeUser } from "@/types/user"
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ import { useIntl } from "react-intl"
|
||||
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { countries } from "@/constants/countries"
|
||||
import { countries } from "@scandic-hotels/trpc/constants/countries"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ import { useController } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { Select } from "@scandic-hotels/design-system/Select"
|
||||
|
||||
import { countries } from "@/constants/countries"
|
||||
import { countries } from "@scandic-hotels/trpc/constants/countries"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user