Merged in feat/sw-2863-move-contentstack-router-to-trpc-package (pull request #2389)

feat(SW-2863): Move contentstack router to trpc package

* Add exports to packages and lint rule to prevent relative imports

* 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

* Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2025-06-26 07:53:01 +00:00
parent 0263ab8c87
commit 002d093af4
921 changed files with 3112 additions and 3008 deletions

View File

@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -9,10 +9,10 @@
// RoomRate,
// SignedInDetailsSchema,
// } from "@/types/components/hotelReservation/enterDetails/details"
// import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
// import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
// import type { SelectRateSearchParams } from "@/types/components/hotelReservation/selectRate/selectRate"
// import { CurrencyEnum } from "@/types/enums/currency"
// import { PackageTypeEnum } from "@/types/enums/packages"
// import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
// import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages"
// export const booking: SelectRateSearchParams = {
// city: "Stockholm",

View File

@@ -2,9 +2,10 @@
import { z } from "zod"
import * as api from "@scandic-hotels/trpc/api"
import { countriesMap } from "@/constants/countries"
import { ApiLang } from "@/constants/languages"
import * as api from "@/lib/api"
import { getProfile } from "@/lib/trpc/memoizedRequests"
import { protectedServerActionProcedure } from "@/server/trpc"

View File

@@ -12,7 +12,7 @@ import styles from "./page.module.css"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function MyPages({}: PageArgs<
LangParams & { path: string[] }

View File

@@ -5,7 +5,7 @@ import TrackingSDK from "@/components/TrackingSDK"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function ProfilePage({}: PageArgs<LangParams>) {
const caller = await serverClient()

View File

@@ -1,4 +1,4 @@
import { setPreviewData } from "@/lib/previewContext"
import { setPreviewData } from "@scandic-hotels/trpc/previewContext"
import InitLivePreview from "@/components/LivePreview"

View File

@@ -6,8 +6,6 @@ import { env } from "@/env/server"
import CampaignOverviewPage from "@/components/ContentType/CampaignOverviewPage"
import CampaignOverviewPageSkeleton from "@/components/ContentType/CampaignOverviewPage/CampaignOverviewPageSkeleton"
export { generateMetadata } from "@/utils/generateMetadata"
export default async function CampaignOverviewPagePage() {
if (!env.CAMPAIGN_PAGES_ENABLED) {
notFound()

View File

@@ -6,7 +6,7 @@ import { env } from "@/env/server"
import CampaignPage from "@/components/ContentType/CampaignPage"
import CampaignPageSkeleton from "@/components/ContentType/CampaignPage/CampaignPageSkeleton"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function CampaignPagePage() {
if (!env.CAMPAIGN_PAGES_ENABLED) {

View File

@@ -1,6 +1,6 @@
import CollectionPage from "@/components/ContentType/StaticPages/CollectionPage"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default function CollectionPagePage() {
return <CollectionPage />

View File

@@ -9,7 +9,7 @@ import ContentPage from "@/components/ContentType/StaticPages/ContentPage"
import { getLang } from "@/i18n/serverContext"
import { isLoggedInUser } from "@/utils/isLoggedInUser"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function ContentPagePage() {
const lang = await getLang()

View File

@@ -8,7 +8,7 @@ import DestinationCityPageSkeleton from "@/components/ContentType/DestinationPag
import type { PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function DestinationCityPagePage(
props: PageArgs<{}, { view?: "map"; filterFromUrl?: string }>

View File

@@ -8,7 +8,7 @@ import DestinationCountryPageSkeleton from "@/components/ContentType/Destination
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function DestinationCountryPagePage(
props: PageArgs<LangParams, { view?: "map"; filterFromUrl?: string }>

View File

@@ -6,7 +6,7 @@ import DestinationOverviewPage from "@/components/ContentType/DestinationPage/De
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default function DestinationOverviewPagePage({}: PageArgs<LangParams>) {
if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") {

View File

@@ -9,7 +9,7 @@ import HotelSubpage from "@/components/ContentType/HotelSubpage"
import type { PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function HotelPagePage(
props: PageArgs<{}, { subpage?: string; view?: "map" }>

View File

@@ -1,6 +1,6 @@
import LoyaltyPage from "@/components/ContentType/LoyaltyPage"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default function LoyaltyPagePage() {
return <LoyaltyPage />

View File

@@ -7,7 +7,7 @@ import { parseBookingWidgetSearchParams } from "@/utils/url"
import type { NextSearchParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/generateMetadata"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function StartPagePage(
props: PageArgs<{}, NextSearchParams>

View File

@@ -1,10 +1,11 @@
import { notFound } from "next/navigation"
import { myStay } from "@scandic-hotels/common/constants/routes/myStay"
import {
BookingErrorCodeEnum,
PaymentCallbackStatusEnum,
} from "@/constants/booking"
import { myStay } from "@/constants/routes/myStay"
import { serverClient } from "@/lib/trpc/server"
import GuaranteeCallback from "@/components/HotelReservation/MyStay/Ancillaries/GuaranteeCallback"

View File

@@ -1,8 +1,8 @@
import { notFound } from "next/navigation"
import { GetCurrentBlockPage } from "@/lib/graphql/Query/Current/CurrentBlockPage.graphql"
import { GetCurrentBlockPageTrackingData } from "@/lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql"
import { request } from "@/lib/graphql/request"
import { GetCurrentBlockPage } from "@scandic-hotels/trpc/graphql/Query/Current/CurrentBlockPage.graphql"
import { GetCurrentBlockPageTrackingData } from "@scandic-hotels/trpc/graphql/Query/Current/CurrentBlockPageTrackingData.graphql"
import { request } from "@scandic-hotels/trpc/graphql/request"
import ContentPage from "@/components/Current/ContentPage"
import Tracking from "@/components/Current/Tracking"
@@ -11,9 +11,11 @@ import type { LangParams, PageArgs, UriParams } from "@/types/params"
import type { GetCurrentBlockPageData } from "@/types/requests/currentBlockPage"
import type { TrackingData } from "@/types/requests/trackingData"
export default async function CurrentContentPage(props: PageArgs<LangParams, UriParams>) {
const searchParams = await props.searchParams;
const params = await props.params;
export default async function CurrentContentPage(
props: PageArgs<LangParams, UriParams>
) {
const searchParams = await props.searchParams
const params = await props.params
try {
if (!searchParams.uri) {
throw new Error("Bad URI")

View File

@@ -1,10 +1,10 @@
import { type NextRequest, NextResponse } from "next/server"
import { languageSchema } from "@scandic-hotels/common/utils/languages"
import { env } from "@/env/server"
import { serverClient } from "@/lib/trpc/server"
import { languageSchema } from "@/utils/languages"
export const dynamic = "force-dynamic"
export async function GET(request: NextRequest) {

View File

@@ -4,12 +4,11 @@ import { z } from "zod"
import { Lang } from "@scandic-hotels/common/constants/language"
import { getCacheClient } from "@scandic-hotels/common/dataCache"
import { generateHotelUrlTag } from "@scandic-hotels/trpc/utils/generateTag"
import { env } from "@/env/server"
import { badRequest, internalServerError, notFound } from "@/server/errors/next"
import { generateHotelUrlTag } from "@/utils/generateTag"
import type { NextRequest } from "next/server"
const validateJsonBody = z.object({

View File

@@ -4,12 +4,11 @@ import { z } from "zod"
import { Lang } from "@scandic-hotels/common/constants/language"
import { getCacheClient } from "@scandic-hotels/common/dataCache"
import { generateLoyaltyConfigTag } from "@scandic-hotels/trpc/utils/generateTag"
import { env } from "@/env/server"
import { badRequest, internalServerError, notFound } from "@/server/errors/next"
import { generateLoyaltyConfigTag } from "@/utils/generateTag"
import type { NextRequest } from "next/server"
enum LoyaltyConfigContentTypes {

View File

@@ -2,12 +2,11 @@ import { revalidateTag } from "next/cache"
import { headers } from "next/headers"
import { getCacheClient } from "@scandic-hotels/common/dataCache"
import { generateTag } from "@scandic-hotels/trpc/utils/generateTag"
import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next"
import { generateTag } from "@/utils/generateTag"
import type { Lang } from "@scandic-hotels/common/constants/language"
// This file is primarily to be used locally to test

View File

@@ -4,20 +4,19 @@ import { z } from "zod"
import { Lang } from "@scandic-hotels/common/constants/language"
import { getCacheClient } from "@scandic-hotels/common/dataCache"
import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next"
import { affix as breadcrumbsAffix } from "@/server/routers/contentstack/breadcrumbs/utils"
import { languageSwitcherAffix } from "@/server/routers/contentstack/languageSwitcher/utils"
import { affix as metadataAffix } from "@/server/routers/contentstack/metadata/utils"
import { affix as pageSettingsAffix } from "@/server/routers/contentstack/pageSettings/utils"
import { resolveEntryCacheKey } from "@/utils/entry"
import { affix as breadcrumbsAffix } from "@scandic-hotels/trpc/routers/contentstack/breadcrumbs/utils"
import { languageSwitcherAffix } from "@scandic-hotels/trpc/routers/contentstack/languageSwitcher/utils"
import { affix as metadataAffix } from "@scandic-hotels/trpc/routers/contentstack/metadata/utils"
import { affix as pageSettingsAffix } from "@scandic-hotels/trpc/routers/contentstack/pageSettings/utils"
import { resolveEntryCacheKey } from "@scandic-hotels/trpc/utils/entry"
import {
generateRefsResponseTag,
generateRefTag,
generateTag,
} from "@/utils/generateTag"
} from "@scandic-hotels/trpc/utils/generateTag"
import { env } from "@/env/server"
import { badRequest, internalServerError } from "@/server/errors/next"
import type { NextRequest } from "next/server"

View File

@@ -1,9 +1,9 @@
import { type NextRequest, NextResponse } from "next/server"
import { dt } from "@scandic-hotels/common/dt"
import { createCounter } from "@scandic-hotels/common/telemetry"
import { env } from "@/env/server"
import { dt } from "@/lib/dt"
import {
getEntries,

View File

@@ -1,11 +1,9 @@
import { type Lang } from "@scandic-hotels/common/constants/language"
import { createCounter } from "@scandic-hotels/common/telemetry"
import { removeTrailingSlash } from "@scandic-hotels/common/utils/url"
import { env } from "@/env/server"
import { removeTrailingSlash } from "@/utils/url"
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { SyncItem } from "@/types/sitemap"
export function mergeEntries(

View File

@@ -16,7 +16,7 @@ import HotelListingItem from "./HotelListingItem"
import styles from "./campaignHotelListing.module.css"
import type { HotelDataWithUrl } from "@/types/hotel"
import type { HotelDataWithUrl } from "@scandic-hotels/trpc/types/hotel"
interface CampaignHotelListingClientProps {
heading: string

View File

@@ -13,7 +13,7 @@ import { getSingleDecimal } from "@/utils/numberFormatting"
import styles from "./hotelListingItem.module.css"
import type { Hotel } from "@/types/hotel"
import type { Hotel } from "@scandic-hotels/trpc/types/hotel"
interface HotelListingItemProps {
hotel: Hotel

View File

@@ -1,3 +1,8 @@
import {
CardsGridEnum,
CardsGridLayoutEnum,
} from "@scandic-hotels/trpc/types/cardsGridEnum"
import InfoCard from "@/components/ContentType/StartPage/InfoCard"
import SectionContainer from "@/components/Section/Container"
import SectionHeader from "@/components/Section/Header"
@@ -7,7 +12,6 @@ import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard"
import TeaserCard from "@/components/TempDesignSystem/TeaserCard"
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
import type { StackableGridProps } from "../TempDesignSystem/Grids/Stackable/stackable"
export default function CardsGrid({ cards_grid }: CardsGridProps) {

View File

@@ -2,10 +2,9 @@
import { useIntl } from "react-intl"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { dt } from "@/lib/dt"
import Button from "@/components/TempDesignSystem/Button"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"

View File

@@ -1,7 +1,6 @@
import {
MembershipLevelEnum,
membershipLevels,
} from "@/constants/membershipLevels"
import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels"
import { membershipLevels } from "@/constants/membershipLevels"
import MembershipLevelIcon from "@/components/Levels/Icon"
import Body from "@/components/TempDesignSystem/Text/Body"

View File

@@ -1,6 +1,5 @@
import { Lang } from "@scandic-hotels/common/constants/language"
import { dt } from "@/lib/dt"
import { dt } from "@scandic-hotels/common/dt"
import Body from "@/components/TempDesignSystem/Text/Body"
import { getIntl } from "@/i18n"

View File

@@ -1,4 +1,5 @@
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels"
import { serverClient } from "@/lib/trpc/server"
import { getIntl } from "@/i18n"

View File

@@ -1,12 +1,10 @@
"use client"
import { useReducer } from "react"
import { useIntl } from "react-intl"
import {
type MembershipLevel,
membershipLevels,
} from "@/constants/membershipLevels"
import { type MembershipLevel } from "@scandic-hotels/common/constants/membershipLevels"
import { membershipLevels } from "@/constants/membershipLevels"
import MembershipLevelIcon from "@/components/Levels/Icon"
import DeprecatedSelect from "@/components/TempDesignSystem/DeprecatedSelect"

View File

@@ -1,12 +1,13 @@
import {
type MembershipLevel,
MembershipLevelEnum,
} from "@/constants/membershipLevels"
} from "@scandic-hotels/common/constants/membershipLevels"
import { getSteppedUpLevel } from "@/utils/user"
import type { LevelWithRewards } from "@scandic-hotels/trpc/routers/contentstack/loyaltyLevel/output"
import {
type LevelWithRewards,
OverviewTableActionsEnum,
type OverviewTableClientProps,
type OverviewTableReducerAction,

View File

@@ -3,8 +3,9 @@
import { usePathname } from "next/navigation"
import { useIntl } from "react-intl"
import { dt } from "@scandic-hotels/common/dt"
import { webviews } from "@/constants/routes/webviews"
import { dt } from "@/lib/dt"
import Link from "@/components/TempDesignSystem/Link"
import Table from "@/components/TempDesignSystem/Table"

View File

@@ -2,7 +2,7 @@
import { useIntl } from "react-intl"
import { dt } from "@/lib/dt"
import { dt } from "@scandic-hotels/common/dt"
import Table from "@/components/TempDesignSystem/Table"
import Body from "@/components/TempDesignSystem/Text/Body"

View File

@@ -2,6 +2,8 @@
import { useRef, useState } from "react"
import { type Reward } from "@scandic-hotels/trpc/types/rewards"
import { REWARDS_PER_PAGE } from "@/constants/rewards"
import { trpc } from "@/lib/trpc/client"
@@ -19,7 +21,6 @@ import Redeem from "../Redeem"
import styles from "./current.module.css"
import type { CurrentRewardsClientProps } from "@/types/components/myPages/myPage/accountPage"
import type { Reward } from "@/types/components/myPages/rewards"
export default function ClientCurrentRewards({
rewards: initialData,

View File

@@ -1,6 +1,7 @@
import { Lock } from "react-feather"
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels"
import { getMembershipLevel } from "@/lib/trpc/memoizedRequests"
import { serverClient } from "@/lib/trpc/server"

View File

@@ -14,7 +14,7 @@ import { RewardIcon } from "../../RewardIcon"
import styles from "../redeem.module.css"
import type { Campaign } from "@/types/components/myPages/rewards"
import type { Campaign } from "@scandic-hotels/trpc/types/rewards"
export default function Campaign({ reward }: { reward: Campaign }) {
const intl = useIntl()

View File

@@ -16,7 +16,7 @@ import useRedeemFlow from "../useRedeemFlow"
import styles from "../redeem.module.css"
import type { Surprise, Tier } from "@/types/components/myPages/rewards"
import type { Surprise, Tier } from "@scandic-hotels/trpc/types/rewards"
export default function Tier({
reward,

View File

@@ -2,10 +2,9 @@
import { useIntl } from "react-intl"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { dt } from "@/lib/dt"
import Countdown from "@/components/Countdown"
import Caption from "@/components/TempDesignSystem/Text/Caption"

View File

@@ -25,12 +25,13 @@ import { RedeemContext } from "./useRedeemFlow"
import styles from "./redeem.module.css"
import type { Reward } from "@scandic-hotels/trpc/types/rewards"
import type {
RedeemModalState,
RedeemProps,
RedeemStep,
} from "@/types/components/myPages/myPage/accountPage"
import type { Reward } from "@/types/components/myPages/rewards"
const MotionOverlay = motion.create(ModalOverlay)
const MotionModal = motion.create(Modal)

View File

@@ -6,8 +6,9 @@ import { trpc } from "@/lib/trpc/client"
import { getFirstRedeemableCoupon } from "@/utils/rewards"
import type { Reward } from "@scandic-hotels/trpc/types/rewards"
import type { RedeemFlowContext } from "@/types/components/myPages/myPage/accountPage"
import type { Reward } from "@/types/components/myPages/rewards"
export const RedeemContext = createContext<RedeemFlowContext>({
redeemStep: "initial",

View File

@@ -1,4 +1,6 @@
import { REWARD_IDS } from "@/constants/rewards"
// import { REWARD_IDS } from "@scandic-hotels/trpc/types/rewards"
import { REWARD_IDS, type RewardId } from "@scandic-hotels/trpc/types/rewards"
import { IconName } from "@/components/Icons/iconName"
import { IllustrationByIconName } from "@/components/Icons/IllustrationByIconName"
@@ -7,7 +9,7 @@ import { isValidRewardId } from "@/utils/rewards"
import type { IconProps } from "@scandic-hotels/design-system/Icons"
import type { FC } from "react"
import type { RewardId } from "@/types/components/myPages/rewards"
// import type { RewardId } from "@/types/components/myPages/rewards"
function getIconForRewardId(rewardId: RewardId): IconName {
switch (rewardId) {

View File

@@ -1,6 +1,11 @@
import { mapRewardToIcon } from "./data"
import type { RewardIconProps } from "@/types/components/myPages/rewards"
import type { LogoAndIllustrationProps } from "@scandic-hotels/design-system/Icons"
export interface RewardIconProps extends LogoAndIllustrationProps {
rewardId: string
iconSize?: "small" | "medium" | "large"
}
// Original SVG aspect ratio is 358:202 (≈1.77:1)
const sizeMap = {

View File

@@ -1,9 +1,8 @@
"use client"
import { dt } from "@scandic-hotels/common/dt"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { dt } from "@/lib/dt"
import Image from "@/components/Image"
import Link from "@/components/TempDesignSystem/Link"
import Caption from "@/components/TempDesignSystem/Text/Caption"

View File

@@ -1,5 +1,7 @@
import { Suspense } from "react"
import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent"
import { env } from "@/env/server"
import HowItWorks from "@/components/Blocks/DynamicContent/HowItWorks"
@@ -22,7 +24,6 @@ import LoadingSpinner from "@/components/LoadingSpinner"
import JobylonFeed from "./JobylonFeed"
import type { DynamicContentProps } from "@/types/components/blocks/dynamicContent"
import { DynamicContentEnum } from "@/types/enums/dynamicContent"
export default function DynamicContent(props: DynamicContentProps) {
return (

View File

@@ -6,7 +6,7 @@ import IconByCSSelect from "@/components/Icons/IconByCSSelect"
import styles from "./essentials.module.css"
import type { EssentialsBlock } from "@/types/trpc/routers/contentstack/campaignPage"
import type { EssentialsBlock } from "@scandic-hotels/trpc/types/campaignPage"
interface EssentialsProps {
content: EssentialsBlock

View File

@@ -1,6 +1,6 @@
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
import type { IntlShape } from "react-intl"
import type { AdditionalData, Hotel } from "@/types/hotel"
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
export function getTypeSpecificInformation(

View File

@@ -1,5 +1,7 @@
import { Suspense } from "react"
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
import CardsGrid from "@/components/Blocks/CardsGrid"
import CarouselCards from "@/components/Blocks/CarouselCards"
import DynamicContent from "@/components/Blocks/DynamicContent"
@@ -17,7 +19,6 @@ import JoinScandicFriends from "./JoinScandicFriends"
import Table from "./Table"
import type { BlocksProps } from "@/types/components/blocks"
import { BlocksEnums } from "@/types/enums/blocks"
export default function Blocks({ blocks }: BlocksProps) {
return blocks.map(async (block, idx) => {

View File

@@ -5,10 +5,10 @@ import { useSearchParams } from "next/navigation"
import { use, useEffect, useRef, useState } from "react"
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 "@/constants/booking"
import { dt } from "@/lib/dt"
import { trpc } from "@/lib/trpc/client"
import { StickyElementNameEnum } from "@/stores/sticky-position"

View File

@@ -4,12 +4,12 @@ import { Button } from "react-aria-components"
import { useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
import { dt } from "@scandic-hotels/common/dt"
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 { shortDateFormat } from "@/constants/dateFormats"
import { dt } from "@/lib/dt"
import SkeletonShimmer from "@/components/SkeletonShimmer"
import useLang from "@/hooks/useLang"

View File

@@ -1,4 +1,4 @@
import type { ImageVaultAsset } from "@/types/components/imageVault"
import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault"
export interface ContentCardProps {
link?: {

View File

@@ -7,7 +7,7 @@ import { getLang } from "@/i18n/serverContext"
import styles from "./topCampaign.module.css"
import { type CampaignOverviewPageData } from "@/types/trpc/routers/contentstack/campaignOverviewPage"
import type { CampaignOverviewPageData } from "@scandic-hotels/trpc/types/campaignOverviewPage"
interface TopCampaignProps {
topCampaign: CampaignOverviewPageData["topCampaign"]

View File

@@ -1,5 +1,7 @@
import { Suspense } from "react"
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
import AccordionSection from "@/components/Blocks/Accordion"
import CampaignHotelListing from "@/components/Blocks/CampaignHotelListing"
import CampaignHotelListingSkeleton from "@/components/Blocks/CampaignHotelListing/CampaignHotelListingSkeleton"
@@ -7,7 +9,6 @@ import CarouselCards from "@/components/Blocks/CarouselCards"
import Essentials from "@/components/Blocks/Essentials"
import type { BlocksProps } from "@/types/components/blocks"
import { BlocksEnums } from "@/types/enums/blocks"
export default function Blocks({ blocks }: BlocksProps) {
return blocks.map(async (block) => {

View File

@@ -1,6 +1,6 @@
import type { Hero } from "@scandic-hotels/trpc/types/campaignPage"
import type { VariantProps } from "class-variance-authority"
import type { Hero } from "@/types/trpc/routers/contentstack/campaignPage"
import type { variants } from "./variants"
export interface HeroProps

View File

@@ -1,12 +1,13 @@
"use client"
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
import { useDestinationDataStore } from "@/stores/destination-data"
import AccordionSection from "@/components/Blocks/Accordion"
import JsonToHtml from "@/components/JsonToHtml"
import type { BlocksProps } from "@/types/components/blocks"
import { BlocksEnums } from "@/types/enums/blocks"
export default function Blocks({ blocks }: BlocksProps) {
const { activeFilters } = useDestinationDataStore((state) => ({

View File

@@ -15,7 +15,7 @@ import ExperienceList from "../../ExperienceList"
import styles from "./cityListingItem.module.css"
import type { DestinationCityListItem } from "@/types/trpc/routers/contentstack/destinationCityPage"
import type { DestinationCityListItem } from "@scandic-hotels/trpc/types/destinationCityPage"
interface CityListingItemProps {
city: DestinationCityListItem

View File

@@ -4,6 +4,7 @@ import { useRef } from "react"
import { useIntl } from "react-intl"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { useDestinationDataStore } from "@/stores/destination-data"
@@ -17,8 +18,6 @@ import CityListingSkeleton from "./CityListingSkeleton"
import styles from "./cityListing.module.css"
import { AlertTypeEnum } from "@/types/enums/alert"
export default function CityListing() {
const intl = useIntl()
const scrollRef = useRef<HTMLElement>(null)

View File

@@ -3,6 +3,8 @@
import { useIntl } from "react-intl"
import { useMediaQuery } from "usehooks-ts"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import Alert from "@/components/TempDesignSystem/Alert"
import HotelCardCarousel from "../../../HotelCardCarousel"
@@ -10,8 +12,7 @@ import HotelListItem from "../HotelListItem"
import styles from "./hotelList.module.css"
import { AlertTypeEnum } from "@/types/enums/alert"
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
interface HotelListContentProps {
hotelsCount: number

View File

@@ -17,7 +17,7 @@ import { getVisibleHotels } from "./utils"
import styles from "./hotelList.module.css"
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
export default function HotelList() {
const intl = useIntl()

View File

@@ -1,4 +1,4 @@
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
export function getVisibleHotels(
hotels: DestinationPagesHotelData[],

View File

@@ -19,7 +19,7 @@ import { getSingleDecimal } from "@/utils/numberFormatting"
import styles from "./hotelListItem.module.css"
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
export default function HotelListItem(data: DestinationPagesHotelData) {
const intl = useIntl()

View File

@@ -11,8 +11,9 @@ import HotelList from "./HotelList"
import styles from "./cityMap.module.css"
import type { CityLocation } from "@scandic-hotels/trpc/types/locations"
import type { MapLocation } from "@/types/components/mapLocation"
import type { CityLocation } from "@/types/trpc/routers/hotel/locations"
interface CityMapProps {
mapId: string

View File

@@ -1,12 +1,14 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort"
import { getFiltersFromHotels } from "@scandic-hotels/trpc/routers/contentstack/metadata/helpers"
import { env } from "@/env/server"
import {
getDestinationCityPage,
getHotelsByCityIdentifier,
} from "@/lib/trpc/memoizedRequests"
import { getFiltersFromHotels } from "@/stores/destination-data/helper"
import Breadcrumbs from "@/components/Breadcrumbs"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
@@ -29,7 +31,6 @@ import DestinationCityPageSkeleton from "./DestinationCityPageSkeleton"
import styles from "./destinationCityPage.module.css"
import type { SortItem } from "@/types/components/destinationFilterAndSort"
import { SortOption } from "@/types/enums/destinationFilterAndSort"
interface DestinationCityPageProps {
isMapView: boolean

View File

@@ -2,6 +2,8 @@
import { useIntl } from "react-intl"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { useDestinationDataStore } from "@/stores/destination-data"
import DestinationFilterAndSort from "@/components/DestinationFilterAndSort"
@@ -13,8 +15,6 @@ import CityListSkeleton from "./CityListSkeleton"
import styles from "./cityList.module.css"
import { AlertTypeEnum } from "@/types/enums/alert"
export default function CityList() {
const intl = useIntl()
const { activeCities, isLoading } = useDestinationDataStore((state) => ({

View File

@@ -12,7 +12,7 @@ import ExperienceList from "../../../ExperienceList"
import styles from "./cityListItem.module.css"
import type { DestinationCityListItem } from "@/types/trpc/routers/contentstack/destinationCityPage"
import type { DestinationCityListItem } from "@scandic-hotels/trpc/types/destinationCityPage"
interface CityListItemProps {
city: DestinationCityListItem

View File

@@ -1,13 +1,15 @@
import { notFound } from "next/navigation"
import { Suspense } from "react"
import { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort"
import { getFiltersFromHotels } from "@scandic-hotels/trpc/routers/contentstack/metadata/helpers"
import { env } from "@/env/server"
import {
getDestinationCityPagesByCountry,
getDestinationCountryPage,
getHotelsByCountry,
} from "@/lib/trpc/memoizedRequests"
import { getFiltersFromHotels } from "@/stores/destination-data/helper"
import Breadcrumbs from "@/components/Breadcrumbs"
import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton"
@@ -29,7 +31,6 @@ import DestinationCountryPageSkeleton from "./DestinationCountryPageSkeleton"
import styles from "./destinationCountryPage.module.css"
import type { SortItem } from "@/types/components/destinationFilterAndSort"
import { SortOption } from "@/types/enums/destinationFilterAndSort"
interface DestinationCountryPageProps {
isMapView: boolean

View File

@@ -6,7 +6,14 @@ import { getIntl } from "@/i18n"
import styles from "./destination.module.css"
import type { DestinationProps } from "@/types/components/destinationOverviewPage/destinationsList/destinationsData"
import type { DestinationCountry } from "@scandic-hotels/trpc/types/destinationsData"
type DestinationProps = {
country: string
countryUrl: string | undefined
numberOfHotels: number
cities: DestinationCountry["cities"]
}
export default async function Destination({
country,

View File

@@ -6,7 +6,11 @@ import Destination from "./Destination"
import styles from "./destinationsList.module.css"
import type { DestinationsListProps } from "@/types/components/destinationOverviewPage/destinationsList/destinationsData"
import type { DestinationsData } from "@scandic-hotels/trpc/types/destinationsData"
type DestinationsListProps = {
destinations: DestinationsData
}
export function DestinationsList({ destinations }: DestinationsListProps) {
const middleIndex = Math.ceil(destinations.length / 2)

View File

@@ -11,7 +11,7 @@ import HotelMapCard from "../HotelMapCard"
import styles from "./hotelCardCarousel.module.css"
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
interface MapCardCarouselProps {
visibleHotels: DestinationPagesHotelData[]

View File

@@ -21,7 +21,7 @@ import { getSingleDecimal } from "@/utils/numberFormatting"
import styles from "./hotelListingItem.module.css"
import type { DestinationPagesHotelData } from "@/types/hotel"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
export default function HotelListingItem(data: DestinationPagesHotelData) {
const intl = useIntl()

View File

@@ -7,6 +7,7 @@ import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType"
import { useDestinationDataStore } from "@/stores/destination-data"
@@ -21,8 +22,6 @@ import HotelListingSkeleton from "./HotelListingSkeleton"
import styles from "./hotelListing.module.css"
import { AlertTypeEnum } from "@/types/enums/alert"
export default function HotelListing() {
const intl = useIntl()
const scrollRef = useRef<HTMLElement>(null)

View File

@@ -16,8 +16,9 @@ import DialogImage from "./DialogImage"
import styles from "./hotelMapCard.module.css"
import type { Amenities } from "@scandic-hotels/trpc/types/hotel"
import type { GalleryImage } from "@/types/components/imageGallery"
import type { Amenities } from "@/types/hotel"
interface HotelMapCardProps {
amenities: Amenities

View File

@@ -29,8 +29,9 @@ import { getHotelMapMarkers, mapMarkerDataToGeoJson } from "./utils"
import styles from "./map.module.css"
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
import type { MapLocation } from "@/types/components/mapLocation"
import type { DestinationPagesHotelData } from "@/types/hotel"
interface MapProps {
hotels: DestinationPagesHotelData[]

View File

@@ -1,9 +1,10 @@
import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel"
import type {
DestinationMarker,
MarkerFeature,
MarkerGeojson,
} from "@/types/components/maps/destinationMarkers"
import type { DestinationPagesHotelData } from "@/types/hotel"
export function mapMarkerDataToGeoJson(markers: DestinationMarker[]) {
const features = markers.map<MarkerFeature>(

View File

@@ -10,8 +10,8 @@ import Button from "@/components/TempDesignSystem/Button"
import SidePeek from "@/components/TempDesignSystem/SidePeek"
import { trackOpenSidePeekOnDestinationPagesEvent } from "@/utils/tracking/destinationPage"
import type { DestinationCityPageData } from "@/types/trpc/routers/contentstack/destinationCityPage"
import type { DestinationCountryPageData } from "@/types/trpc/routers/contentstack/destinationCountryPage"
import type { DestinationCityPageData } from "@scandic-hotels/trpc/types/destinationCityPage"
import type { DestinationCountryPageData } from "@scandic-hotels/trpc/types/destinationCountryPage"
interface DestinationPageSidepeekProps {
buttonText?: string | null

View File

@@ -10,7 +10,7 @@ import { mapImageVaultImagesToGalleryImages } from "@/utils/imageGallery"
import styles from "./topImages.module.css"
import type { ImageVaultAsset } from "@/types/components/imageVault"
import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault"
interface TopImageProps {
images: ImageVaultAsset[]

View File

@@ -1,7 +1,6 @@
import type { CategorizedFilters } from "@scandic-hotels/trpc/types/destinationFilterAndSort"
import type { IntlShape } from "react-intl"
import type { CategorizedFilters } from "@/types/components/destinationFilterAndSort"
export function getHeadingText(
intl: IntlShape,
location: string,

View File

@@ -20,9 +20,10 @@ import Sidebar from "./Sidebar"
import styles from "./hotelMapPage.module.css"
import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel"
import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker"
import type { Coordinates } from "@/types/components/maps/coordinates"
import type { MarkerInfo } from "@/types/components/maps/marker"
import type { PointOfInterest } from "@/types/hotel"
interface HotelMapPageClientProps {
apiKey: string

View File

@@ -7,6 +7,7 @@ import { Button as ButtonRAC } from "react-aria-components"
import { useIntl } from "react-intl"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest"
import PoiMarker from "@/components/Maps/Markers/Poi"
@@ -14,7 +15,6 @@ import styles from "./sidebar.module.css"
import type { SidebarProps } from "@/types/components/hotelPage/map/sidebar"
import type { Coordinates } from "@/types/components/maps/coordinates"
import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest"
export default function Sidebar({
activePoi,

View File

@@ -4,7 +4,8 @@ import CardImage from "./CardImage"
import styles from "./cardGrid.module.css"
import type { ActivityCard } from "@/types/trpc/routers/contentstack/hotelPage"
import type { ActivityCard } from "@scandic-hotels/trpc/types/hotelPage"
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
export default function ActivitiesCardGrid(activitiesCard: ActivityCard) {

View File

@@ -5,8 +5,9 @@ import { getIntl } from "@/i18n"
import styles from "./tripAdvisorLink.module.css"
import type { HotelTripAdvisor } from "@scandic-hotels/trpc/types/hotel"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { HotelTripAdvisor } from "@/types/hotel"
interface TripAdvisorLinkProps {
tripAdvisor: NonNullable<HotelTripAdvisor>

View File

@@ -3,7 +3,7 @@ import type {
HotelAddress,
HotelLocation,
HotelTripAdvisor,
} from "@/types/hotel"
} from "@scandic-hotels/trpc/types/hotel"
export type IntroSectionProps = {
address: HotelAddress

View File

@@ -1,5 +1,6 @@
import FacebookIcon from "@scandic-hotels/design-system/Icons/FacebookIcon"
import InstagramIcon from "@scandic-hotels/design-system/Icons/InstagramIcon"
import { Country } from "@scandic-hotels/trpc/types/country"
import Image from "@/components/Image"
import Link from "@/components/TempDesignSystem/Link"
@@ -13,7 +14,6 @@ import { getLang } from "@/i18n/serverContext"
import styles from "./contactInformation.module.css"
import type { ContactInformationProps } from "@/types/components/hotelPage/sidepeek/aboutTheHotel"
import { Country } from "@/types/enums/country"
export default async function ContactInformation({
hotelAddress,

View File

@@ -2,7 +2,7 @@ import Image from "@/components/Image"
import styles from "./images.module.css"
import type { ApiImage } from "@/types/hotel"
import type { ApiImage } from "@scandic-hotels/trpc/types/hotel"
interface SidePeekImagesProps {
images: ApiImage[]

View File

@@ -11,7 +11,7 @@ import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
import styles from "./roomFacilities.module.css"
import type { Room } from "@/types/hotel"
import type { Room } from "@scandic-hotels/trpc/types/hotel"
interface RoomFacilitiesProps {
roomFacilities: Room["roomFacilities"]

View File

@@ -9,7 +9,7 @@ import getFilteredRoomTypes from "./utils"
import styles from "./roomTypes.module.css"
import type { Room } from "@/types/hotel"
import type { Room } from "@scandic-hotels/trpc/types/hotel"
interface RoomFacilitiesProps {
roomTypes: Room["roomTypes"]

View File

@@ -1,4 +1,4 @@
import type { Room } from "@/types/hotel"
import type { Room } from "@scandic-hotels/trpc/types/hotel"
type RoomType = Room["roomTypes"][number]

View File

@@ -1,9 +1,9 @@
import Link from "next/link"
import { dt } from "@scandic-hotels/common/dt"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { selectRateWithParams } from "@/constants/routes/hotelReservation"
import { dt } from "@/lib/dt"
import ImageGallery from "@/components/ImageGallery"
import Button from "@/components/TempDesignSystem/Button"

View File

@@ -1,7 +1,6 @@
import type { Room } from "@scandic-hotels/trpc/types/hotel"
import type { IntlShape } from "react-intl"
import type { Room } from "@/types/hotel"
export function getBedDescriptionText(
intl: IntlShape,
bed: Room["roomTypes"][number]["mainBed"]

View File

@@ -7,8 +7,9 @@ import { getLang } from "@/i18n/serverContext"
import styles from "./tripAdvisor.module.css"
import type { HotelRatings } from "@scandic-hotels/trpc/types/hotel"
import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage"
import type { HotelRatings } from "@/types/hotel"
type TripAdvisorSidePeekProps = {
hotelName: string

View File

@@ -1,3 +1,5 @@
import { FacilityEnum } from "@scandic-hotels/trpc/enums/facilities"
import { IconByIconName } from "@/components/Icons/IconByIconName"
import { IconName } from "@/components/Icons/iconName"
@@ -8,8 +10,6 @@ import type {
import type { MaterialIconSetIconProps } from "@scandic-hotels/design-system/Icons/MaterialIcon"
import type { JSX } from "react"
import { FacilityEnum } from "@/types/enums/facilities"
const facilityToIconMap: Record<FacilityEnum, IconName> = {
[FacilityEnum.AccessibleBathingControls]: IconName.StarFilled,
[FacilityEnum.AccessibleBathtubs]: IconName.StarFilled,

View File

@@ -1,4 +1,6 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { Hotel, HotelData } from "@scandic-hotels/trpc/types/hotel"
import type { HotelPage } from "@scandic-hotels/trpc/types/hotelPage"
import type { IntlShape } from "react-intl"
import { HealthFacilitiesEnum } from "@/types/components/hotelPage/facilities"
@@ -12,8 +14,6 @@ import {
type TrackingSDKPageData,
} from "@/types/components/tracking"
import { HotelHashValues } from "@/types/enums/hotelPage"
import type { Hotel, HotelData } from "@/types/hotel"
import type { HotelPage } from "@/types/trpc/routers/contentstack/hotelPage"
export function getRoomNameAsParam(roomName: string) {
return roomName

View File

@@ -8,7 +8,7 @@ import HtmlContent from "../HtmlContent"
import styles from "./accessibilitySubpage.module.css"
import type { AdditionalData } from "@/types/hotel"
import type { AdditionalData } from "@scandic-hotels/trpc/types/hotel"
interface AccessibilitySubpageProps {
hotelName: string

View File

@@ -6,7 +6,7 @@ import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/Bread
import styles from "./heroHeader.module.css"
import type { ApiImage } from "@/types/hotel"
import type { ApiImage } from "@scandic-hotels/trpc/types/hotel"
interface HeroHeaderProps {
breadcrumbsTitle: string

View File

@@ -16,7 +16,7 @@ import MeetingsAdditionalContent from "./MeetingRooms"
import styles from "./meetingsSubpage.module.css"
import type { AdditionalData, Hotel } from "@/types/hotel"
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
interface MeetingsSubpageProps {
hotelId: string

View File

@@ -10,7 +10,7 @@ import ParkingSidebar from "../Sidebar/ParkingSidebar"
import styles from "./parkingSubpage.module.css"
import type { AdditionalData, Hotel } from "@/types/hotel"
import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel"
interface ParkingSubpageProps {
hotel: Hotel

View File

@@ -10,7 +10,7 @@ import RestaurantSidebar from "../Sidebar/RestaurantSidebar"
import styles from "./restaurantSubpage.module.css"
import type { Hotel, Restaurant } from "@/types/hotel"
import type { Hotel, Restaurant } from "@scandic-hotels/trpc/types/hotel"
interface RestaurantSubpageProps {
restaurant: Restaurant

View File

@@ -1,12 +1,11 @@
import { Typography } from "@scandic-hotels/design-system/Typography"
import { Country } from "@scandic-hotels/trpc/types/country"
import Link from "@/components/TempDesignSystem/Link"
import { getIntl } from "@/i18n"
import styles from "./sidebar.module.css"
import { Country } from "@/types/enums/country"
interface MeetingsSidebarProps {
phoneNumber: string
email?: string

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