chore: add consistent type imports

This commit is contained in:
Christian Andolf
2024-12-09 14:36:56 +01:00
parent 9867a56cc8
commit e08e960209
172 changed files with 587 additions and 333 deletions

View File

@@ -1,6 +1,13 @@
{
"extends": ["next/core-web-vitals", "plugin:import/recommended"],
"plugins": ["simple-import-sort"],
"extends": [
"next/core-web-vitals",
"plugin:import/recommended"
],
"plugins": [
"simple-import-sort",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"rules": {
"react/function-component-definition": "error",
"simple-import-sort/imports": [
@@ -8,13 +15,21 @@
{
"groups": [
// Side effect imports.
["^\\u0000"],
[
"^\\u0000"
],
// Node.js builtins.
["^node:"],
[
"^node:"
],
// NPM packages.
["^@?\\w"],
[
"^@?\\w"
],
// Internal packages.
["^@scandic-hotels/(?!.*\u0000$).*$"],
[
"^@scandic-hotels/(?!.*\u0000$).*$"
],
// Local imports (lib, constants, etc.), excl. types.
[
"^@/constants/?(?!.*\u0000$).*$",
@@ -24,7 +39,9 @@
"^@/stores/?(?!.*\u0000$).*$"
],
// Local imports (the rest), excl. types.
["^@/(?!(types|.*\u0000$)).*$"],
[
"^@/(?!(types|.*\u0000$)).*$"
],
// Parent imports. Put `..` last.
// Other relative imports. Put same-folder imports and `.` last.
[
@@ -35,9 +52,14 @@
"^\\./?$"
],
// Style imports.
["^(?!\\u0000).+\\.s?css$"],
[
"^(?!\\u0000).+\\.s?css$"
],
// Node.js builtins and NPM packages type imports.
["^node:.*\\u0000$", "^@?\\w.*\\u0000$"],
[
"^node:.*\\u0000$",
"^@?\\w.*\\u0000$"
],
// Local type imports.
[
"^@scandichotels/.*\\u0000$",
@@ -52,6 +74,12 @@
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error"
"import/no-duplicates": [
"error",
{
"prefer-inline": true
}
],
"@typescript-eslint/consistent-type-imports": "error"
}
}

View File

@@ -1,4 +1,4 @@
import { NextRequest, NextResponse } from "next/server"
import { type NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth"
import { Lang } from "@/constants/languages"

View File

@@ -4,7 +4,7 @@ import Breadcrumbs from "@/components/Breadcrumbs"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function AllBreadcrumbs({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -6,7 +6,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function CommunicationSlot({
params,

View File

@@ -9,7 +9,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function CreditCardSlot({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -9,7 +9,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function MembershipCardSlot({
params,

View File

@@ -3,7 +3,7 @@ import { getProfile } from "@/lib/trpc/memoizedRequests"
import Form from "@/components/Forms/Edit/Profile"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function EditProfileSlot({
params,

View File

@@ -20,7 +20,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function Profile({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -5,7 +5,7 @@ import { serverClient } from "@/lib/trpc/server"
import TrackingSDK from "@/components/TrackingSDK"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"

View File

@@ -4,7 +4,7 @@ import Breadcrumbs from "@/components/Breadcrumbs"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function PageBreadcrumbs({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -2,7 +2,7 @@ import { setPreviewData } from "@/lib/previewContext"
import InitLivePreview from "@/components/LivePreview"
import { PageArgs, UIDParams } from "@/types/params"
import type { PageArgs, UIDParams } from "@/types/params"
export default function PreviewPage({
searchParams,

View File

@@ -1,6 +1,6 @@
import styles from "./layout.module.css"
import {
import type {
ContentTypeParams,
LangParams,
LayoutArgs,

View File

@@ -11,7 +11,7 @@ import CollectionPage from "@/components/ContentType/StaticPages/CollectionPage"
import ContentPage from "@/components/ContentType/StaticPages/ContentPage"
import { setLang } from "@/i18n/serverContext"
import {
import type {
ContentTypeParams,
LangParams,
PageArgs,

View File

@@ -1,6 +1,6 @@
import styles from "./layout.module.css"
import { LangParams, LayoutArgs } from "@/types/params"
import type { LangParams, LayoutArgs } from "@/types/params"
export default function PaymentCallbackLayout({
children,

View File

@@ -12,7 +12,7 @@ import { serverClient } from "@/lib/trpc/server"
import PaymentCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function PaymentCallbackPage({
params,

View File

@@ -1,6 +1,6 @@
import styles from "./layout.module.css"
import { LangParams, LayoutArgs } from "@/types/params"
import type { LangParams, LayoutArgs } from "@/types/params"
export default function HotelReservationLayout({
children,

View File

@@ -1,6 +1,6 @@
import styles from "./layout.module.css"
import { LangParams, LayoutArgs } from "@/types/params"
import type { LangParams, LayoutArgs } from "@/types/params"
export default function HotelReservationLayout({
children,

View File

@@ -1,7 +1,7 @@
import { Dayjs } from "dayjs"
import { dt } from "@/lib/dt"
import type { Dayjs } from "dayjs"
/**
* Get valid dates from stringFromDate and stringToDate making sure that they are not in the past and chronologically correct
* @example const { fromDate, toDate} = getValidDates("2021-01-01", "2021-01-02")

View File

@@ -29,7 +29,7 @@ import EnterDetailsProvider from "@/providers/EnterDetailsProvider"
import styles from "./page.module.css"
import { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
import { StepEnum } from "@/types/enums/step"
import type { LangParams, PageArgs } from "@/types/params"

View File

@@ -1,4 +1,4 @@
import { NextRequest, NextResponse } from "next/server"
import { type NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth"
import { Lang } from "@/constants/languages"

View File

@@ -1,14 +1,13 @@
import { NextRequest, NextResponse } from "next/server"
import { type NextRequest, NextResponse } from "next/server"
import { AuthError } from "next-auth"
import { Lang } from "@/constants/languages"
import { login } from "@/constants/routes/handleAuth"
import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next"
import { getPublicURL } from "@/server/utils"
import { signIn } from "@/auth"
import type { Lang } from "@/constants/languages"
export async function GET(
request: NextRequest,
context: { params: { lang: Lang } }

View File

@@ -2,7 +2,7 @@ import { env } from "@/env/server"
import BookingWidget, { preload } from "@/components/BookingWidget"
import { PageArgs } from "@/types/params"
import type { PageArgs } from "@/types/params"
export default async function BookingWidgetPage({
searchParams,

View File

@@ -3,7 +3,7 @@ import { serverClient } from "@/lib/trpc/server"
import BookingWidget, { preload } from "@/components/BookingWidget"
import { PageArgs } from "@/types/params"
import type { PageArgs } from "@/types/params"
export default async function BookingWidgetPage({
searchParams,

View File

@@ -4,7 +4,7 @@ import CurrentFooter from "@/components/Current/Footer"
import Footer, { preload } from "@/components/Footer"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function FooterSlot({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -7,7 +7,7 @@ import HeaderFallback from "@/components/Current/Header/HeaderFallback"
import Header from "@/components/Header"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function HeaderPage({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -16,7 +16,7 @@ import { findLang } from "@/utils/languages"
import styles from "./error.module.css"
import { LangParams } from "@/types/params"
import type { LangParams } from "@/types/params"
export default function Error({
error,

View File

@@ -1,7 +1,7 @@
import NotFound from "@/components/Current/NotFound"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function NotFoundPage({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -2,7 +2,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, LayoutArgs, StatusParams } from "@/types/params"
import type { LangParams, LayoutArgs, StatusParams } from "@/types/params"
export default function MiddlewareError({
params,

View File

@@ -1,7 +1,7 @@
import Header from "@/components/Current/Header"
import { setLang } from "@/i18n/serverContext"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default async function HeaderPage({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -7,7 +7,7 @@ import AccountPage from "@/components/Webviews/AccountPage"
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
import { setLang } from "@/i18n/serverContext"
import {
import type {
ContentTypeWebviewParams,
LangParams,
PageArgs,

View File

@@ -3,7 +3,7 @@ import { setLang } from "@/i18n/serverContext"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
import type { LangParams, PageArgs } from "@/types/params"
export default function Refresh({ params }: PageArgs<LangParams>) {
setLang(params.lang)

View File

@@ -1,4 +1,3 @@
import { NextRequest } from "next/server"
import { env } from "process"
import { Lang } from "@/constants/languages"
@@ -6,6 +5,8 @@ import { profile } from "@/constants/routes/myPages"
import { serverClient } from "@/lib/trpc/server"
import { getPublicURL } from "@/server/utils"
import type { NextRequest } from "next/server"
export async function GET(
request: NextRequest,
{ params }: { params: { lang: string } }

View File

@@ -1,6 +1,4 @@
import { NextResponse } from "next/server"
import type { NextRequest } from "next/server"
import { type NextRequest, NextResponse } from "next/server"
export async function GET(request: NextRequest) {
return NextResponse.json(Object.fromEntries(request.headers.entries()))

View File

@@ -1,6 +1,5 @@
import { revalidateTag } from "next/cache"
import { headers } from "next/headers"
import { NextRequest } from "next/server"
import { z } from "zod"
import { Lang } from "@/constants/languages"
@@ -9,6 +8,8 @@ import { badRequest, internalServerError, notFound } from "@/server/errors/next"
import { generateLoyaltyConfigTag } from "@/utils/generateTag"
import type { NextRequest } from "next/server"
enum LoyaltyConfigContentTypes {
loyalty_level = "loyalty_level",
reward = "reward",

View File

@@ -1,12 +1,13 @@
import { revalidateTag } from "next/cache"
import { headers } from "next/headers"
import { Lang } from "@/constants/languages"
import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next"
import { generateTag } from "@/utils/generateTag"
import type { Lang } from "@/constants/languages"
// This file is primarily to be used locally to test
// purging your cache for new (and old) requests
export async function POST() {

View File

@@ -1,6 +1,5 @@
import { revalidateTag } from "next/cache"
import { headers } from "next/headers"
import { NextRequest } from "next/server"
import { z } from "zod"
import { Lang } from "@/constants/languages"
@@ -17,6 +16,8 @@ import {
generateTag,
} from "@/utils/generateTag"
import type { NextRequest } from "next/server"
const validateJsonBody = z.object({
data: z.object({
content_type: z.object({

View File

@@ -12,7 +12,7 @@ import SectionWrapper from "../SectionWrapper"
import styles from "./loyaltyLevels.module.css"
import { LoyaltyLevelsProps } from "@/types/components/blocks/dynamicContent"
import type { LoyaltyLevelsProps } from "@/types/components/blocks/dynamicContent"
import type { LevelCardProps } from "@/types/components/overviewTable"
export default async function LoyaltyLevels({

View File

@@ -1,6 +1,6 @@
import { VariantProps } from "class-variance-authority"
import type { VariantProps } from "class-variance-authority"
import { heroVariants } from "./heroVariants"
import type { heroVariants } from "./heroVariants"
export interface HeroProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">,

View File

@@ -1,6 +1,7 @@
import { HeroProps } from "./hero"
import { heroVariants } from "./heroVariants"
import type { HeroProps } from "./hero"
export default function Hero({ className, color, children }: HeroProps) {
const classNames = heroVariants({ className, color })
return <section className={classNames}>{children}</section>

View File

@@ -7,7 +7,7 @@ import { getMembership } from "@/utils/user"
import PointsContainer from "./Container"
import { NextLevelPointsColumn, YourPointsColumn } from "./PointsColumn"
import { UserProps } from "@/types/components/myPages/user"
import type { UserProps } from "@/types/components/myPages/user"
export default async function Points({ user }: UserProps) {
const intl = await getIntl()

View File

@@ -4,7 +4,7 @@ import { useReducer } from "react"
import { useIntl } from "react-intl"
import {
MembershipLevel,
type MembershipLevel,
MembershipLevelEnum,
} from "@/constants/membershipLevels"
@@ -22,8 +22,8 @@ import styles from "./overviewTable.module.css"
import type { Key } from "react-aria-components"
import {
ComparisonLevel,
DesktopSelectColumns,
type ComparisonLevel,
type DesktopSelectColumns,
type MobileColumnHeaderProps,
OverviewTableActionsEnum,
type OverviewTableClientProps,

View File

@@ -4,7 +4,7 @@ import { serverClient } from "@/lib/trpc/server"
import SectionWrapper from "../SectionWrapper"
import OverviewTableClient from "./Client"
import { OverviewTableProps } from "@/types/components/blocks/dynamicContent"
import type { OverviewTableProps } from "@/types/components/blocks/dynamicContent"
export default async function OverviewTable({
dynamic_content,

View File

@@ -9,7 +9,7 @@ import {
type LevelWithRewards,
OverviewTableActionsEnum,
type OverviewTableClientProps,
OverviewTableReducerAction,
type OverviewTableReducerAction,
} from "@/types/components/overviewTable"
export function getLevel(

View File

@@ -10,7 +10,7 @@ import Pagination from "@/components/MyPages/Pagination"
import ClientTable from "./ClientTable"
import { Transactions } from "@/types/components/myPages/myPage/earnAndBurn"
import type { Transactions } from "@/types/components/myPages/myPage/earnAndBurn"
export default function TransactionTable({
initialJourneyTransactions,

View File

@@ -5,7 +5,7 @@ import SectionHeader from "@/components/Section/Header"
import ExpiringPointsTable from "./ExpiringPointsTable"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function ExpiringPoints({
link,

View File

@@ -12,8 +12,8 @@ import {
YourPointsColumn,
} from "../../../Overview/Stats/Points/PointsColumn"
import { UserProps } from "@/types/components/myPages/user"
import { LangParams } from "@/types/params"
import type { UserProps } from "@/types/components/myPages/user"
import type { LangParams } from "@/types/params"
/* TODO */
export default async function Points({ user, lang }: UserProps & LangParams) {

View File

@@ -1,8 +1,8 @@
import { FC } from "react"
import { getIconByIconName } from "@/components/Icons/get-icon-by-icon-name"
import { isValidRewardId } from "@/utils/rewards"
import type { FC } from "react"
import { IconName, type IconProps } from "@/types/components/icon"
import { RewardId } from "@/types/enums/rewards"

View File

@@ -1,6 +1,6 @@
import { mapRewardToIcon } from "./data"
import { RewardIconProps } from "@/types/components/myPages/rewards"
import type { RewardIconProps } from "@/types/components/myPages/rewards"
// Original SVG aspect ratio is 358:202 (≈1.77:1)
const sizeMap = {

View File

@@ -6,7 +6,7 @@ import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
import SignupForm from "@/components/Forms/Signup"
import { getLang } from "@/i18n/serverContext"
import { SignupFormWrapperProps } from "@/types/components/blocks/dynamicContent"
import type { SignupFormWrapperProps } from "@/types/components/blocks/dynamicContent"
export default async function SignupFormWrapper({
dynamic_content,

View File

@@ -8,7 +8,7 @@ import Grids from "@/components/TempDesignSystem/Grids"
import StayCard from "../StayCard"
import EmptyUpcomingStaysBlock from "./EmptyUpcomingStays"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
export default async function SoonestStays({
title,

View File

@@ -1,4 +1,4 @@
import { UspIcon } from "@/types/components/blocks/uspGrid"
import type { UspIcon } from "@/types/components/blocks/uspGrid"
import { IconName } from "@/types/components/icon"
export function getUspIconName(icon?: UspIcon | null) {

View File

@@ -1,4 +1,4 @@
import {
import type {
HotelAddress,
HotelData,
HotelLocation,

View File

@@ -1,6 +1,6 @@
"use client"
import { PropsWithChildren, useRef } from "react"
import { type PropsWithChildren, useRef } from "react"
import { StickyElementNameEnum } from "@/stores/sticky-position"

View File

@@ -6,7 +6,7 @@ import { getIntl } from "@/i18n"
import styles from "./facility.module.css"
import { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility"
import type { FacilityProps } from "@/types/components/hotelPage/sidepeek/facility"
export default async function Facility({ data }: FacilityProps) {
const intl = await getIntl()

View File

@@ -1,8 +1,8 @@
import { FC } from "react"
import { getIconByIconName } from "@/components/Icons/get-icon-by-icon-name"
import { IconName, IconProps } from "@/types/components/icon"
import type { FC } from "react"
import { IconName, type IconProps } from "@/types/components/icon"
import { FacilityEnum } from "@/types/enums/facilities"
const facilityToIconMap: Record<FacilityEnum, IconName> = {

View File

@@ -1,10 +1,9 @@
import { staticPageVariants } from "./variants"
import type { VariantProps } from "class-variance-authority"
import type { TrackingSDKPageData } from "@/types/components/tracking"
import type { CollectionPage } from "@/types/trpc/routers/contentstack/collectionPage"
import type { ContentPage } from "@/types/trpc/routers/contentstack/contentPage"
import type { staticPageVariants } from "./variants"
export interface StaticPageProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "content">,

View File

@@ -2,8 +2,7 @@ import { cva } from "class-variance-authority"
import styles from "./list.module.css"
import type { ListItem } from "@/types/requests/blocks/list"
import { BlockListItemsEnum } from "@/types/requests/blocks/list"
import { BlockListItemsEnum, type ListItem } from "@/types/requests/blocks/list"
const config = {
variants: {

View File

@@ -1,7 +1,7 @@
"use client"
import { useCallback, useEffect, useRef, useState } from "react"
import { Lang, languages } from "@/constants/languages"
import { type Lang, languages } from "@/constants/languages"
import Link from "@/components/TempDesignSystem/Link"
import useLang from "@/hooks/useLang"

View File

@@ -1,7 +1,7 @@
"use client"
import { useState } from "react"
import { Lang, languages } from "@/constants/languages"
import { type Lang, languages } from "@/constants/languages"
import useLang from "@/hooks/useLang"

View File

@@ -1,7 +1,7 @@
import Desktop from "./Desktop"
import Mobile from "./Mobile"
import { LanguageSwitcherData } from "@/types/requests/languageSwitcher"
import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher"
type LanguageSwitcherProps = { urls: LanguageSwitcherData }

View File

@@ -3,7 +3,6 @@ import { Fragment } from "react"
import { useIntl } from "react-intl"
import { logout } from "@/constants/routes/handleAuth"
import { navigationQueryRouter } from "@/server/routers/contentstack/myPages/navigation/query"
import useDropdownStore from "@/stores/main-menu"
import Divider from "@/components/TempDesignSystem/Divider"
@@ -14,6 +13,7 @@ import useLang from "@/hooks/useLang"
import styles from "./my-pages-mobile-dropdown.module.css"
import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown"
import type { navigationQueryRouter } from "@/server/routers/contentstack/myPages/navigation/query"
type Navigation = Awaited<ReturnType<(typeof navigationQueryRouter)["get"]>>

View File

@@ -1,4 +1,4 @@
import { Lang } from "@/constants/languages"
import type { Lang } from "@/constants/languages"
type Texts = {
title: string

View File

@@ -3,7 +3,7 @@
import { usePathname, useSearchParams } from "next/navigation"
import { useEffect, useState } from "react"
import {
import type {
SiteSectionObject,
TrackingData,
TrackingProps,

View File

@@ -7,13 +7,13 @@ import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml"
import { EmbedEnum } from "@/types/requests/utils/embeds"
import type { Attributes } from "@/types/rte/attrs"
import { RTEItemTypeEnum, RTETypeEnum } from "@/types/rte/enums"
import type {
RTEDefaultNode,
RTENext,
RTENode,
RTERegularNode,
import {
type RTEDefaultNode,
RTEMarkType,
type RTENext,
type RTENode,
type RTERegularNode,
} from "@/types/rte/node"
import { RTEMarkType } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option"
function extractPossibleAttributes(attrs: Attributes | undefined) {

View File

@@ -17,7 +17,7 @@ import { hasAvailableParagraphFormat, hasAvailableULFormat } from "./utils"
import styles from "./jsontohtml.module.css"
import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml"
import { ImageVaultAsset } from "@/types/components/imageVault"
import type { ImageVaultAsset } from "@/types/components/imageVault"
import { EmbedEnum } from "@/types/requests/utils/embeds"
import type { Attributes, RTEImageVaultAttrs } from "@/types/rte/attrs"
import {
@@ -25,15 +25,15 @@ import {
RTEItemTypeEnum,
RTETypeEnum,
} from "@/types/rte/enums"
import type {
RTEDefaultNode,
RTEImageNode,
RTENext,
RTENode,
RTERegularNode,
RTETextNode,
import {
type RTEDefaultNode,
type RTEImageNode,
RTEMarkType,
type RTENext,
type RTENode,
type RTERegularNode,
type RTETextNode,
} from "@/types/rte/node"
import { RTEMarkType } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option"
function extractPossibleAttributes(attrs: Attributes | undefined) {

View File

@@ -8,12 +8,13 @@ import {
AvailableULFormatEnum,
RTETypeEnum,
} from "@/types/rte/enums"
import type {
RTENode,
RTERenderOptionComponent,
RTETextNode,
import {
RTEMarkType,
type RTENode,
type RTERenderMark,
type RTERenderOptionComponent,
type RTETextNode,
} from "@/types/rte/node"
import { RTEMarkType, RTERenderMark } from "@/types/rte/node"
import type { RenderOptions } from "@/types/rte/option"
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {

View File

@@ -12,7 +12,7 @@ import { getLang } from "@/i18n/serverContext"
import styles from "./details.module.css"
import type { SocialIconsProps } from "@/types/components/footer/socialIcons"
import { IconName } from "@/types/components/icon"
import type { IconName } from "@/types/components/icon"
function SocialIcon({ iconName }: SocialIconsProps) {
const SocialIcon = getIconByIconName(iconName as IconName)

View File

@@ -1,4 +1,4 @@
import React, { forwardRef, InputHTMLAttributes } from "react"
import React, { forwardRef, type InputHTMLAttributes } from "react"
import { Input as InputRAC } from "react-aria-components"
import Body from "@/components/TempDesignSystem/Text/Body"

View File

@@ -1,9 +1,9 @@
"use client"
import Downshift from "downshift"
import {
ChangeEvent,
FocusEvent,
FormEvent,
type ChangeEvent,
type FocusEvent,
type FormEvent,
useCallback,
useEffect,
useReducer,

View File

@@ -14,7 +14,7 @@ import styles from "./form.module.css"
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
import type { BookingWidgetFormProps } from "@/types/components/form/bookingwidget"
import { Location } from "@/types/trpc/routers/hotel/locations"
import type { Location } from "@/types/trpc/routers/hotel/locations"
const formId = "booking-widget"

View File

@@ -26,7 +26,7 @@ import Title from "@/components/TempDesignSystem/Text/Title"
import { toast } from "@/components/TempDesignSystem/Toasts"
import useLang from "@/hooks/useLang"
import { SignUpSchema, signUpSchema } from "./schema"
import { type SignUpSchema, signUpSchema } from "./schema"
import styles from "./form.module.css"
@@ -191,7 +191,7 @@ export default function SignupForm({ link, subtitle, title }: SignUpFormProps) {
</Body>
</section>
{/*
{/*
This is a manual validation trigger workaround:
- The Controller component (which Input uses) doesn't re-render on submit,
which prevents automatic error display.

View File

@@ -9,7 +9,7 @@ import Counter from "../Counter"
import styles from "./adult-selector.module.css"
import { SelectorProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
import type { SelectorProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
export default function AdultSelector({
roomIndex = 0,

View File

@@ -10,7 +10,7 @@ import Caption from "@/components/TempDesignSystem/Text/Caption"
import styles from "./child-selector.module.css"
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
import {
import type {
ChildBed,
ChildInfoSelectorProps,
} from "@/types/components/bookingWidget/guestsRoomsPicker"

View File

@@ -10,7 +10,7 @@ import ChildInfoSelector from "./ChildInfoSelector"
import styles from "./child-selector.module.css"
import { SelectorProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
import type { SelectorProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
export default function ChildSelector({
roomIndex = 0,

View File

@@ -14,9 +14,9 @@ import ChildSelector from "./ChildSelector"
import styles from "./guests-rooms-picker.module.css"
import { BookingWidgetSchema } from "@/types/components/bookingWidget"
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
import { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker"
import type { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker"
export default function GuestsRoomsPickerDialog({
rooms,

View File

@@ -18,7 +18,7 @@ import PickerForm from "./Form"
import styles from "./guests-rooms-picker.module.css"
import { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker"
import type { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker"
export default function GuestsRoomsPickerForm() {
const { watch, trigger } = useFormContext()

View File

@@ -1,9 +1,9 @@
import Image from "@/components/Image"
import { HeroProps } from "./hero"
import styles from "./hero.module.css"
import type { HeroProps } from "./hero"
export default async function Hero({ alt, src, focalPoint }: HeroProps) {
return (
<Image

View File

@@ -12,7 +12,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import styles from "./receipt.module.css"
import { BookingConfirmationReceiptProps } from "@/types/components/hotelReservation/bookingConfirmation/receipt"
import type { BookingConfirmationReceiptProps } from "@/types/components/hotelReservation/bookingConfirmation/receipt"
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
export default function Receipt({

View File

@@ -10,7 +10,7 @@ import useLang from "@/hooks/useLang"
import styles from "./contact.module.css"
import { ContactProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
import type { ContactProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
export default function Contact({ hotel }: ContactProps) {
const lang = useLang()

View File

@@ -9,7 +9,7 @@ import Button from "@/components/TempDesignSystem/Button"
import styles from "./header.module.css"
import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
import { ToggleSidePeekProps } from "@/types/components/hotelReservation/toggleSidePeekProps"
import type { ToggleSidePeekProps } from "@/types/components/hotelReservation/toggleSidePeekProps"
export default function ToggleSidePeek({ hotelId }: ToggleSidePeekProps) {
const intl = useIntl()

View File

@@ -36,7 +36,7 @@ import { bedTypeMap } from "../../SelectRate/RoomSelection/utils"
import PriceChangeDialog from "../PriceChangeDialog"
import GuaranteeDetails from "./GuaranteeDetails"
import PaymentOption from "./PaymentOption"
import { PaymentFormData, paymentSchema } from "./schema"
import { type PaymentFormData, paymentSchema } from "./schema"
import styles from "./payment.module.css"

View File

@@ -1,15 +1,18 @@
import Image from "next/image"
import { useFormContext } from "react-hook-form"
import { PAYMENT_METHOD_ICONS, PaymentMethodEnum } from "@/constants/booking"
import {
PAYMENT_METHOD_ICONS,
type PaymentMethodEnum,
} from "@/constants/booking"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import { PaymentOptionProps } from "./paymentOption"
import styles from "./paymentOption.module.css"
import type { PaymentOptionProps } from "./paymentOption"
export default function PaymentOption({
name,
value,

View File

@@ -1,4 +1,4 @@
import { RegisterOptions } from "react-hook-form"
import type { RegisterOptions } from "react-hook-form"
export interface PaymentOptionProps {
name: string

View File

@@ -2,7 +2,7 @@ import { getSavedPaymentCardsSafely } from "@/lib/trpc/memoizedRequests"
import PaymentClient from "./PaymentClient"
import { PaymentProps } from "@/types/components/hotelReservation/selectRate/section"
import type { PaymentProps } from "@/types/components/hotelReservation/selectRate/section"
export default async function Payment({
user,

View File

@@ -8,7 +8,7 @@ import Title from "@/components/TempDesignSystem/Text/Title"
import styles from "./priceChangeDialog.module.css"
import { PriceChangeDialogProps } from "@/types/components/hotelReservation/enterDetails/priceChangeDialog"
import type { PriceChangeDialogProps } from "@/types/components/hotelReservation/enterDetails/priceChangeDialog"
export default function PriceChangeDialog({
isOpen,

View File

@@ -1,6 +1,6 @@
"use client"
import { PropsWithChildren, useEffect, useRef } from "react"
import { type PropsWithChildren, useEffect, useRef } from "react"
import { useIntl } from "react-intl"
import { useEnterDetailsStore } from "@/stores/enter-details"

View File

@@ -10,7 +10,7 @@ import SummaryBottomSheet from "./BottomSheet"
import styles from "./mobile.module.css"
import type { SummaryProps } from "@/types/components/hotelReservation/summary"
import { DetailsState } from "@/types/stores/enter-details"
import type { DetailsState } from "@/types/stores/enter-details"
function storeSelector(state: DetailsState) {
return {

View File

@@ -3,7 +3,6 @@ import { useParams } from "next/dist/client/components/navigation"
import { memo, useCallback } from "react"
import { useIntl } from "react-intl"
import { Lang } from "@/constants/languages"
import { selectRate } from "@/constants/routes/hotelReservation"
import { useHotelsMapStore } from "@/stores/hotels-map"
@@ -28,6 +27,7 @@ import styles from "./hotelCard.module.css"
import { HotelCardListingTypeEnum } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
import type { HotelCardProps } from "@/types/components/hotelReservation/selectHotel/hotelCardProps"
import type { Lang } from "@/constants/languages"
function HotelCard({
hotel,
@@ -101,7 +101,6 @@ function HotelCard({
<Caption color="baseTextMediumContrast" type="underline" asChild>
<Link
href={`https://www.google.com/maps/dir/?api=1&destination=${hotelData.location.latitude},${hotelData.location.longitude}`}
className={styles.googleMaps}
target="_blank"
aria-label={intl.formatMessage({
id: "Driving directions",

View File

@@ -4,7 +4,6 @@ import { useParams } from "next/navigation"
import { useState } from "react"
import { useIntl } from "react-intl"
import { Lang } from "@/constants/languages"
import { selectRate } from "@/constants/routes/hotelReservation"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
@@ -22,6 +21,7 @@ import NoPriceAvailableCard from "../HotelCard/NoPriceAvailableCard"
import styles from "./hotelCardDialog.module.css"
import type { HotelCardDialogProps } from "@/types/components/hotelReservation/selectHotel/map"
import type { Lang } from "@/constants/languages"
export default function HotelCardDialog({
data,

View File

@@ -7,7 +7,7 @@ import Button from "@/components/TempDesignSystem/Button"
import styles from "./readMore.module.css"
import { ReadMoreProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
import type { ReadMoreProps } from "@/types/components/hotelReservation/selectHotel/selectHotel"
import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
export default function ReadMore({ label, hotelId, showCTA }: ReadMoreProps) {

View File

@@ -13,7 +13,7 @@ import FilterAndSortModal from "../FilterAndSortModal"
import styles from "./mobileMapButtonContainer.module.css"
import { CategorizedFilters } from "@/types/components/hotelReservation/selectHotel/hotelFilters"
import type { CategorizedFilters } from "@/types/components/hotelReservation/selectHotel/hotelFilters"
export default function MobileMapButtonContainer({
filters,

View File

@@ -21,7 +21,7 @@ import HotelListing from "./HotelListing"
import styles from "./selectHotelMap.module.css"
import { SelectHotelMapProps } from "@/types/components/hotelReservation/selectHotel/map"
import type { SelectHotelMapProps } from "@/types/components/hotelReservation/selectHotel/map"
export default function SelectHotelMap({
apiKey,

View File

@@ -5,7 +5,7 @@ import SelectionCard from "../SelectionCard"
import styles from "./bedSelection.module.css"
import { BedSelectionProps } from "@/types/components/hotelReservation/selectRate/section"
import type { BedSelectionProps } from "@/types/components/hotelReservation/selectRate/section"
export default function BedSelection({
alternatives,

View File

@@ -5,7 +5,7 @@ import SelectionCard from "../SelectionCard"
import styles from "./breakfastSelection.module.css"
import { BreakfastSelectionProps } from "@/types/components/hotelReservation/selectRate/section"
import type { BreakfastSelectionProps } from "@/types/components/hotelReservation/selectRate/section"
export default function BreakfastSelection({
alternatives,

View File

@@ -5,7 +5,7 @@ import Button from "@/components/TempDesignSystem/Button"
import styles from "./details.module.css"
import { DetailsProps } from "@/types/components/hotelReservation/selectRate/section"
import type { DetailsProps } from "@/types/components/hotelReservation/selectRate/section"
export default function Details({ nextPath }: DetailsProps) {
const searchParams = useSearchParams()

View File

@@ -1,4 +1,3 @@
import { Lang } from "@/constants/languages"
import { dt } from "@/lib/dt"
import { getRoomsAvailability } from "@/lib/trpc/memoizedRequests"
@@ -10,8 +9,9 @@ import { generateChildrenString } from "../RoomSelection/utils"
import styles from "./NoRoomsAlert.module.css"
import { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import { AlertTypeEnum } from "@/types/enums/alert"
import type { Lang } from "@/constants/languages"
type Props = {
hotelId: number

View File

@@ -1,6 +1,5 @@
import { Suspense } from "react"
import { Lang } from "@/constants/languages"
import { getHotelData } from "@/lib/trpc/memoizedRequests"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
@@ -19,7 +18,8 @@ import { NoRoomsAlert } from "./NoRoomsAlert"
import styles from "./hotelInfoCard.module.css"
import { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
import type { Lang } from "@/constants/languages"
type Props = {
hotelId: number

View File

@@ -11,7 +11,7 @@ import { calculatePricesPerNight } from "./utils"
import styles from "./priceList.module.css"
import { PriceListProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption"
import type { PriceListProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption"
export default function PriceList({
publicPrice = {},

View File

@@ -11,7 +11,7 @@ import PriceTable from "./PriceList"
import styles from "./flexibilityOption.module.css"
import { FlexibilityOptionProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption"
import type { FlexibilityOptionProps } from "@/types/components/hotelReservation/selectRate/flexibilityOption"
export default function FlexibilityOption({
product,

View File

@@ -3,8 +3,6 @@
import { createElement, useCallback } from "react"
import { useIntl } from "react-intl"
import { RateDefinition } from "@/server/routers/hotels/output"
import ToggleSidePeek from "@/components/HotelReservation/EnterDetails/SelectedRoom/ToggleSidePeek"
import FlexibilityOption from "@/components/HotelReservation/SelectRate/RoomSelection/FlexibilityOption"
import { ErrorCircleIcon } from "@/components/Icons"
@@ -21,6 +19,7 @@ import styles from "./roomCard.module.css"
import type { RoomCardProps } from "@/types/components/hotelReservation/selectRate/roomCard"
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
import { HotelTypeEnum } from "@/types/enums/hotelType"
import type { RateDefinition } from "@/server/routers/hotels/output"
export default function RoomCard({
hotelId,

Some files were not shown because too many files have changed in this diff Show More