diff --git a/.vscode/settings.json b/.vscode/settings.json index 72446f434..25fa6215f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib" } diff --git a/apps/scandic-web/.env b/apps/scandic-web/.env index dfdd53d2c..4fb8642fe 100644 --- a/apps/scandic-web/.env +++ b/apps/scandic-web/.env @@ -3,4 +3,4 @@ DEBUG_QUERIES="false" SEAMLESS_ENVIRONMENT_SUBDOMAIN="www" SEAMLESS_LOGIN="https://${SEAMLESS_ENVIRONMENT_SUBDOMAIN}.scandichotels.{topleveldomain}/updatelogin" -SEAMLESS_LOGOUT="https://${SEAMLESS_ENVIRONMENT_SUBDOMAIN}.scandichotels.{topleveldomain}/updatelogout?newweb=1" +SEAMLESS_LOGOUT="https://${SEAMLESS_ENVIRONMENT_SUBDOMAIN}.scandichotels.{topleveldomain}/updatelogout?newweb=1" \ No newline at end of file diff --git a/apps/scandic-web/__mocks__/hotelReservation/index.ts b/apps/scandic-web/__mocks__/hotelReservation/index.ts index fcbc7d77f..cb42e6fc5 100644 --- a/apps/scandic-web/__mocks__/hotelReservation/index.ts +++ b/apps/scandic-web/__mocks__/hotelReservation/index.ts @@ -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", diff --git a/apps/scandic-web/actions/editProfile.ts b/apps/scandic-web/actions/editProfile.ts index d42d5f95b..e3116e4b9 100644 --- a/apps/scandic-web/actions/editProfile.ts +++ b/apps/scandic-web/actions/editProfile.ts @@ -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" diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx index c0c623398..60402bbc0 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx @@ -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[] } diff --git a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx index af1d431db..8b2740670 100644 --- a/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/profile/page.tsx @@ -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) { const caller = await serverClient() diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/page.tsx index fd52de064..5c95806a0 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/page.tsx @@ -1,4 +1,4 @@ -import { setPreviewData } from "@/lib/previewContext" +import { setPreviewData } from "@scandic-hotels/trpc/previewContext" import InitLivePreview from "@/components/LivePreview" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_overview_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_overview_page/[uid]/page.tsx index d388f5631..e94ba5879 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_overview_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_overview_page/[uid]/page.tsx @@ -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() diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_page/[uid]/page.tsx index 54a81b00f..4e0bbb003 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/campaign_page/[uid]/page.tsx @@ -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) { diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/collection_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/collection_page/[uid]/page.tsx index c552a4fb0..39637c266 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/collection_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/collection_page/[uid]/page.tsx @@ -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 diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/content_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/content_page/[uid]/page.tsx index 52d5af945..b444182a3 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/content_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/content_page/[uid]/page.tsx @@ -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() diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx index c0ac58be5..4b9222854 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_city_page/[uid]/page.tsx @@ -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 }> diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx index 43c8553f3..f51c307c8 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_country_page/[uid]/page.tsx @@ -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 diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_overview_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_overview_page/[uid]/page.tsx index dd4a004a8..4e620374a 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_overview_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/destination_overview_page/[uid]/page.tsx @@ -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) { if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx index 569b66961..1080c4c16 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/hotel_page/[uid]/page.tsx @@ -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" }> diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/loyalty_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/loyalty_page/[uid]/page.tsx index d169bad07..0cfd9a23a 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/loyalty_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/loyalty_page/[uid]/page.tsx @@ -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 diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx index 39c2e10e0..145e1eaa7 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/start_page/[uid]/page.tsx @@ -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> diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx index 48fc6d6f1..756d028ad 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(payment-callback)/gla-payment-callback/page.tsx @@ -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" diff --git a/apps/scandic-web/app/[lang]/(live-current)/current-content-page/page.tsx b/apps/scandic-web/app/[lang]/(live-current)/current-content-page/page.tsx index 7c3a8d4f0..e203827a1 100644 --- a/apps/scandic-web/app/[lang]/(live-current)/current-content-page/page.tsx +++ b/apps/scandic-web/app/[lang]/(live-current)/current-content-page/page.tsx @@ -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) { - const searchParams = await props.searchParams; - const params = await props.params; +export default async function CurrentContentPage( + props: PageArgs +) { + const searchParams = await props.searchParams + const params = await props.params try { if (!searchParams.uri) { throw new Error("Bad URI") diff --git a/apps/scandic-web/app/api/hoteldata/route.ts b/apps/scandic-web/app/api/hoteldata/route.ts index e88202729..caeab048e 100644 --- a/apps/scandic-web/app/api/hoteldata/route.ts +++ b/apps/scandic-web/app/api/hoteldata/route.ts @@ -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) { diff --git a/apps/scandic-web/app/api/web/revalidate/hotel/route.ts b/apps/scandic-web/app/api/web/revalidate/hotel/route.ts index 420d31b07..a175a7adb 100644 --- a/apps/scandic-web/app/api/web/revalidate/hotel/route.ts +++ b/apps/scandic-web/app/api/web/revalidate/hotel/route.ts @@ -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({ diff --git a/apps/scandic-web/app/api/web/revalidate/loyaltyConfig/route.ts b/apps/scandic-web/app/api/web/revalidate/loyaltyConfig/route.ts index 5a312b00e..f5a40a9cc 100644 --- a/apps/scandic-web/app/api/web/revalidate/loyaltyConfig/route.ts +++ b/apps/scandic-web/app/api/web/revalidate/loyaltyConfig/route.ts @@ -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 { diff --git a/apps/scandic-web/app/api/web/revalidate/manually/route.ts b/apps/scandic-web/app/api/web/revalidate/manually/route.ts index 0d1a561fd..b2417c355 100644 --- a/apps/scandic-web/app/api/web/revalidate/manually/route.ts +++ b/apps/scandic-web/app/api/web/revalidate/manually/route.ts @@ -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 diff --git a/apps/scandic-web/app/api/web/revalidate/route.ts b/apps/scandic-web/app/api/web/revalidate/route.ts index e483f8c21..c3c8d2818 100644 --- a/apps/scandic-web/app/api/web/revalidate/route.ts +++ b/apps/scandic-web/app/api/web/revalidate/route.ts @@ -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" diff --git a/apps/scandic-web/app/api/web/sitemap/route.ts b/apps/scandic-web/app/api/web/sitemap/route.ts index 93031c12f..0397cf44a 100644 --- a/apps/scandic-web/app/api/web/sitemap/route.ts +++ b/apps/scandic-web/app/api/web/sitemap/route.ts @@ -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, diff --git a/apps/scandic-web/app/api/web/sitemap/utils.ts b/apps/scandic-web/app/api/web/sitemap/utils.ts index 375f0e472..a98d37cde 100644 --- a/apps/scandic-web/app/api/web/sitemap/utils.ts +++ b/apps/scandic-web/app/api/web/sitemap/utils.ts @@ -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( diff --git a/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx b/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx index 87b7ea581..92ad40b3b 100644 --- a/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx +++ b/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx @@ -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 diff --git a/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx b/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx index 97ee0a8ef..22fb27e1c 100644 --- a/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx +++ b/apps/scandic-web/components/Blocks/CampaignHotelListing/HotelListingItem/index.tsx @@ -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 diff --git a/apps/scandic-web/components/Blocks/CardsGrid.tsx b/apps/scandic-web/components/Blocks/CardsGrid.tsx index 49dff04fc..d0f9de34b 100644 --- a/apps/scandic-web/components/Blocks/CardsGrid.tsx +++ b/apps/scandic-web/components/Blocks/CardsGrid.tsx @@ -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) { diff --git a/apps/scandic-web/components/Blocks/DynamicContent/JobylonFeed/JobylonCard/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/JobylonFeed/JobylonCard/index.tsx index d84573432..78f4f54fd 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/JobylonFeed/JobylonCard/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/JobylonFeed/JobylonCard/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Friend/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Friend/index.tsx index 1403b5a77..b7f5467cd 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Friend/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Friend/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx index 379fa5e76..d408cd88e 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/ExpiringPoints/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/Points/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/Points/index.tsx index 26f2a7da9..60b4b5fa8 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/Points/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Overview/Stats/Points/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/Client.tsx b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/Client.tsx index 5ddf7e825..d0869401c 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/Client.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/Client.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts index d6e3f1483..f97a292f9 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts +++ b/apps/scandic-web/components/Blocks/DynamicContent/OverviewTable/reducer.ts @@ -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, diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx index f97cec20f..0a6aae751 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Points/EarnAndBurn/JourneyTable/ClientTable/Row/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Points/ExpiringPoints/ExpiringPointsTable/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Points/ExpiringPoints/ExpiringPointsTable/index.tsx index d46423353..08385a291 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Points/ExpiringPoints/ExpiringPointsTable/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Points/ExpiringPoints/ExpiringPointsTable/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/CurrentRewards/Client.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/CurrentRewards/Client.tsx index 8128c4cf0..dba047f56 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/CurrentRewards/Client.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/CurrentRewards/Client.tsx @@ -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, diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx index 49c4b9442..ce12dbd2e 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/NextLevel/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx index 54f72e44f..c5115a787 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Campaign.tsx @@ -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() diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Tier.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Tier.tsx index d27190518..2f91cf2ac 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Tier.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/Flows/Tier.tsx @@ -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, diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/TimedRedeemedBadge.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/TimedRedeemedBadge.tsx index b0e4d2d27..bb69619d3 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/TimedRedeemedBadge.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/TimedRedeemedBadge.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/index.tsx index def513685..1b0df3742 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/index.tsx @@ -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) diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/useRedeemFlow.ts b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/useRedeemFlow.ts index 317031586..927ee023c 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/useRedeemFlow.ts +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/Redeem/useRedeemFlow.ts @@ -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({ redeemStep: "initial", diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/data.ts b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/data.ts index a00dffc93..ac98d5f32 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/data.ts +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/data.ts @@ -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) { diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/index.tsx index 33dc8a236..c7ed90d2d 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Rewards/RewardIcon/index.tsx @@ -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 = { diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx index 6b384e078..2dca6e7ff 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/index.tsx index fa873cb94..b18be8432 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/index.tsx @@ -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 ( diff --git a/apps/scandic-web/components/Blocks/Essentials/index.tsx b/apps/scandic-web/components/Blocks/Essentials/index.tsx index 89a0b79cf..3141c2bd0 100644 --- a/apps/scandic-web/components/Blocks/Essentials/index.tsx +++ b/apps/scandic-web/components/Blocks/Essentials/index.tsx @@ -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 diff --git a/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/utils.ts b/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/utils.ts index f3a54d822..abcd797e6 100644 --- a/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/utils.ts +++ b/apps/scandic-web/components/Blocks/HotelListing/HotelListingItem/utils.ts @@ -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( diff --git a/apps/scandic-web/components/Blocks/index.tsx b/apps/scandic-web/components/Blocks/index.tsx index 05ca3d60d..b4036386a 100644 --- a/apps/scandic-web/components/Blocks/index.tsx +++ b/apps/scandic-web/components/Blocks/index.tsx @@ -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) => { diff --git a/apps/scandic-web/components/BookingWidget/Client.tsx b/apps/scandic-web/components/BookingWidget/Client.tsx index 1b892e729..ef279f14d 100644 --- a/apps/scandic-web/components/BookingWidget/Client.tsx +++ b/apps/scandic-web/components/BookingWidget/Client.tsx @@ -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" diff --git a/apps/scandic-web/components/BookingWidget/MobileToggleButton/index.tsx b/apps/scandic-web/components/BookingWidget/MobileToggleButton/index.tsx index 4c0246141..820045571 100644 --- a/apps/scandic-web/components/BookingWidget/MobileToggleButton/index.tsx +++ b/apps/scandic-web/components/BookingWidget/MobileToggleButton/index.tsx @@ -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" diff --git a/apps/scandic-web/components/ContentCard/contentCard.ts b/apps/scandic-web/components/ContentCard/contentCard.ts index 3c40c5cbc..915349aad 100644 --- a/apps/scandic-web/components/ContentCard/contentCard.ts +++ b/apps/scandic-web/components/ContentCard/contentCard.ts @@ -1,4 +1,4 @@ -import type { ImageVaultAsset } from "@/types/components/imageVault" +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" export interface ContentCardProps { link?: { diff --git a/apps/scandic-web/components/ContentType/CampaignOverviewPage/TopCampaign/index.tsx b/apps/scandic-web/components/ContentType/CampaignOverviewPage/TopCampaign/index.tsx index cb69218e3..b518d09db 100644 --- a/apps/scandic-web/components/ContentType/CampaignOverviewPage/TopCampaign/index.tsx +++ b/apps/scandic-web/components/ContentType/CampaignOverviewPage/TopCampaign/index.tsx @@ -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"] diff --git a/apps/scandic-web/components/ContentType/CampaignPage/Blocks/index.tsx b/apps/scandic-web/components/ContentType/CampaignPage/Blocks/index.tsx index e502d29e2..dc7ddbdbc 100644 --- a/apps/scandic-web/components/ContentType/CampaignPage/Blocks/index.tsx +++ b/apps/scandic-web/components/ContentType/CampaignPage/Blocks/index.tsx @@ -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) => { diff --git a/apps/scandic-web/components/ContentType/CampaignPage/Hero/types.ts b/apps/scandic-web/components/ContentType/CampaignPage/Hero/types.ts index bf55686c4..eb622456d 100644 --- a/apps/scandic-web/components/ContentType/CampaignPage/Hero/types.ts +++ b/apps/scandic-web/components/ContentType/CampaignPage/Hero/types.ts @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx index f476ce7ca..2a0ec1234 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx @@ -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) => ({ diff --git a/apps/scandic-web/components/ContentType/DestinationPage/CityListing/CityListingItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/CityListing/CityListingItem/index.tsx index 60e3db337..17240bae4 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/CityListing/CityListingItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/CityListing/CityListingItem/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/CityListing/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/CityListing/index.tsx index 7385bbc07..f4eca0f5b 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/CityListing/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/CityListing/index.tsx @@ -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(null) diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/Content.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/Content.tsx index ab5185871..34af25f9c 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/Content.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/Content.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/index.tsx index 327dc233c..671769693 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/index.tsx @@ -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() diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/utils.ts b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/utils.ts index f03282c5f..d4554a886 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/utils.ts +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelList/utils.ts @@ -1,4 +1,4 @@ -import type { DestinationPagesHotelData } from "@/types/hotel" +import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel" export function getVisibleHotels( hotels: DestinationPagesHotelData[], diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx index f69b4f12c..f945fb511 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/HotelListItem/index.tsx @@ -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() diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/index.tsx index 69090f273..3469ae644 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/CityMap/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx index 405dd6286..6cc45c8d0 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCityPage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityList/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityList/index.tsx index ff4b20e00..2df343cb8 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityList/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityList/index.tsx @@ -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) => ({ diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityListItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityListItem/index.tsx index 4e78ed4b7..e3a4b3714 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityListItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/CountryMap/CityListItem/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx index 5857a793d..4310a42b7 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx index 4fbd2cffb..490428f54 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/Destination/index.tsx @@ -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, diff --git a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx index 6f9c0fbd2..5fe75ecd0 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/DestinationOverviewPage/HotelsSection/DestinationsList/index.tsx @@ -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) diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelCardCarousel/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelCardCarousel/index.tsx index b94ff3480..1d231003c 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelCardCarousel/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelCardCarousel/index.tsx @@ -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[] diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx index c6a0b621b..c3e6c4644 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/HotelListingItem/index.tsx @@ -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() diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/index.tsx index b53f1e773..0b4d0e9c9 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelListing/index.tsx @@ -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(null) diff --git a/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/index.tsx index fa60367a1..5c3c730e1 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/HotelMapCard/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Map/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Map/index.tsx index 8255e6725..7309f9085 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Map/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Map/index.tsx @@ -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[] diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Map/utils.ts b/apps/scandic-web/components/ContentType/DestinationPage/Map/utils.ts index 06cdbd931..db20ccabf 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Map/utils.ts +++ b/apps/scandic-web/components/ContentType/DestinationPage/Map/utils.ts @@ -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( diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Sidepeek/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Sidepeek/index.tsx index dfa070352..cc001fcb9 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Sidepeek/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Sidepeek/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/DestinationPage/TopImages/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/TopImages/index.tsx index 10e0af0eb..6df6105e1 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/TopImages/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/TopImages/index.tsx @@ -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[] diff --git a/apps/scandic-web/components/ContentType/DestinationPage/utils.ts b/apps/scandic-web/components/ContentType/DestinationPage/utils.ts index 57eaa5e61..1b544e3dd 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/utils.ts +++ b/apps/scandic-web/components/ContentType/DestinationPage/utils.ts @@ -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, diff --git a/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx b/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx index 4d40e8e29..95e00fcd3 100644 --- a/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx +++ b/apps/scandic-web/components/ContentType/HotelMapPage/Client.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx b/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx index c76a657ec..ebab791b3 100644 --- a/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelMapPage/Sidebar/index.tsx @@ -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, diff --git a/apps/scandic-web/components/ContentType/HotelPage/Facilities/CardGrid/ActivitiesCardGrid.tsx b/apps/scandic-web/components/ContentType/HotelPage/Facilities/CardGrid/ActivitiesCardGrid.tsx index 101ad5257..9b7452da4 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/Facilities/CardGrid/ActivitiesCardGrid.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/Facilities/CardGrid/ActivitiesCardGrid.tsx @@ -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) { diff --git a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx index 0b935e71f..f51f86529 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/types.ts b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/types.ts index 427e7dcbf..a565943c8 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/types.ts +++ b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/types.ts @@ -3,7 +3,7 @@ import type { HotelAddress, HotelLocation, HotelTripAdvisor, -} from "@/types/hotel" +} from "@scandic-hotels/trpc/types/hotel" export type IntroSectionProps = { address: HotelAddress diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/AboutTheHotel/ContactInformation/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/AboutTheHotel/ContactInformation/index.tsx index a922da14b..623b0617d 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/AboutTheHotel/ContactInformation/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/AboutTheHotel/ContactInformation/index.tsx @@ -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, diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Images/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Images/index.tsx index e24fd92cc..e4aac3b5a 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Images/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Images/index.tsx @@ -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[] diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomFacilities/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomFacilities/index.tsx index 1d4f039b7..4ad21a9e6 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomFacilities/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomFacilities/index.tsx @@ -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"] diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/index.tsx index 43cc32d54..c766a1741 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/index.tsx @@ -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"] diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/utils.ts b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/utils.ts index 6c26d7078..cf6a1d6eb 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/utils.ts +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/RoomTypes/utils.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" type RoomType = Room["roomTypes"][number] diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/index.tsx index 2905aa19c..818b4721d 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/index.tsx @@ -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" diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/utils.ts b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/utils.ts index 982e4295b..a39d3e9a9 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/utils.ts +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Room/utils.ts @@ -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"] diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx index 41e902aa3..cf0693189 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelPage/data.tsx b/apps/scandic-web/components/ContentType/HotelPage/data.tsx index ebe520a25..879bac1b3 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/data.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/data.tsx @@ -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.AccessibleBathingControls]: IconName.StarFilled, [FacilityEnum.AccessibleBathtubs]: IconName.StarFilled, diff --git a/apps/scandic-web/components/ContentType/HotelPage/utils.ts b/apps/scandic-web/components/ContentType/HotelPage/utils.ts index 2b570abbc..018a7f4b0 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/utils.ts +++ b/apps/scandic-web/components/ContentType/HotelPage/utils.ts @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/AccessibilitySubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/AccessibilitySubpage/index.tsx index 5d10a35b1..29e0b534d 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/AccessibilitySubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/AccessibilitySubpage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/HeroHeader/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/HeroHeader/index.tsx index 98f94fb95..3972c0d63 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/HeroHeader/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/HeroHeader/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/MeetingsSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/MeetingsSubpage/index.tsx index 9368cf553..5e8c3889c 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/MeetingsSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/MeetingsSubpage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx index 85132aa25..d2bdb4cbc 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/ParkingSubpage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/RestaurantSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/RestaurantSubpage/index.tsx index 2e286a79e..1fa7fe791 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/RestaurantSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/RestaurantSubpage/index.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/MeetingsSidebar.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/MeetingsSidebar.tsx index 9a858f45f..7a91d3cca 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/MeetingsSidebar.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/MeetingsSidebar.tsx @@ -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 diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/ParkingSidebar.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/ParkingSidebar.tsx index dbfef4cd9..5e28c6350 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/ParkingSidebar.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/ParkingSidebar.tsx @@ -1,12 +1,12 @@ 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" -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" interface HotelSidebarProps { address: Hotel["address"] diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/RestaurantSidebar.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/RestaurantSidebar.tsx index f0d24f515..67c6ae52b 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/RestaurantSidebar.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/RestaurantSidebar.tsx @@ -1,5 +1,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" +import { Country } from "@scandic-hotels/trpc/types/country" import OpeningHours from "@/components/OpeningHours" import Button from "@/components/TempDesignSystem/Button" @@ -8,8 +9,7 @@ import { getIntl } from "@/i18n" import styles from "./sidebar.module.css" -import { Country } from "@/types/enums/country" -import type { Hotel, Restaurant } from "@/types/hotel" +import type { Hotel, Restaurant } from "@scandic-hotels/trpc/types/hotel" interface RestaurantSidebarProps { hotelAddress: Hotel["address"] diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/WellnessSidebar.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/WellnessSidebar.tsx index 16daa5765..b228bc936 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/WellnessSidebar.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/Sidebar/WellnessSidebar.tsx @@ -1,4 +1,5 @@ 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" @@ -8,8 +9,7 @@ import { translateWellnessType } from "../../HotelPage/utils" import styles from "./sidebar.module.css" -import { Country } from "@/types/enums/country" -import type { HealthFacility, Hotel } from "@/types/hotel" +import type { HealthFacility, Hotel } from "@scandic-hotels/trpc/types/hotel" interface WellnessSidebarProps { healthFacilities: HealthFacility[] diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/WellnessSubpage/index.tsx b/apps/scandic-web/components/ContentType/HotelSubpage/WellnessSubpage/index.tsx index da519224f..8e4c837b2 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/WellnessSubpage/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelSubpage/WellnessSubpage/index.tsx @@ -9,7 +9,7 @@ import WellnessSidebar from "../Sidebar/WellnessSidebar" import styles from "./wellnessSubpage.module.css" -import type { AdditionalData, Hotel } from "@/types/hotel" +import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel" interface WellnessSubpageProps { hotel: Hotel diff --git a/apps/scandic-web/components/ContentType/HotelSubpage/utils.ts b/apps/scandic-web/components/ContentType/HotelSubpage/utils.ts index 04b906f7c..2b17a62dc 100644 --- a/apps/scandic-web/components/ContentType/HotelSubpage/utils.ts +++ b/apps/scandic-web/components/ContentType/HotelSubpage/utils.ts @@ -1,4 +1,4 @@ -import type { HotelData } from "@/types/hotel" +import type { HotelData } from "@scandic-hotels/trpc/types/hotel" export function verifySubpageShouldExist( hotelData: HotelData, diff --git a/apps/scandic-web/components/ContentType/StartPage/index.tsx b/apps/scandic-web/components/ContentType/StartPage/index.tsx index 335141b56..b83174bf6 100644 --- a/apps/scandic-web/components/ContentType/StartPage/index.tsx +++ b/apps/scandic-web/components/ContentType/StartPage/index.tsx @@ -1,3 +1,5 @@ +import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks" + import { getStartPage } from "@/lib/trpc/memoizedRequests" import Blocks from "@/components/Blocks" @@ -10,7 +12,6 @@ import TrackingSDK from "@/components/TrackingSDK" import styles from "./startPage.module.css" import type { BookingWidgetSearchData } from "@/types/components/bookingWidget" -import { BlocksEnums } from "@/types/enums/blocks" export default async function StartPage({ booking, diff --git a/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts b/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts index d23d7b525..2e6da2840 100644 --- a/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts +++ b/apps/scandic-web/components/ContentType/StaticPages/staticPage.ts @@ -1,8 +1,8 @@ +import type { CollectionPage } from "@scandic-hotels/trpc/types/collectionPage" +import type { ContentPage } from "@scandic-hotels/trpc/types/contentPage" 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 diff --git a/apps/scandic-web/components/Countdown/index.tsx b/apps/scandic-web/components/Countdown/index.tsx index e474e16da..6669c49de 100644 --- a/apps/scandic-web/components/Countdown/index.tsx +++ b/apps/scandic-web/components/Countdown/index.tsx @@ -3,7 +3,7 @@ import { useState } from "react" import { useInterval } from "usehooks-ts" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import Title from "@/components/TempDesignSystem/Text/Title" diff --git a/apps/scandic-web/components/Current/Aside/Puff/renderOptions.tsx b/apps/scandic-web/components/Current/Aside/Puff/renderOptions.tsx index af9b46e32..dffdeee98 100644 --- a/apps/scandic-web/components/Current/Aside/Puff/renderOptions.tsx +++ b/apps/scandic-web/components/Current/Aside/Puff/renderOptions.tsx @@ -1,7 +1,8 @@ +import { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums" + import styles from "./puff.module.css" import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml" -import { RTETypeEnum } from "@/types/rte/enums" import type { RTEDefaultNode, RTENext } from "@/types/rte/node" import type { RenderOptions } from "@/types/rte/option" diff --git a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx index f6a339e4d..c58ebc3d6 100644 --- a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx +++ b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx @@ -4,7 +4,8 @@ import { usePathname } from "next/navigation" import { useIntl } from "react-intl" -import { findMyBookingCurrentWebPath } from "@/constants/routes/findMyBooking" +import { findMyBookingCurrentWebPath } from "@scandic-hotels/common/constants/routes/findMyBooking" + import { logout } from "@/constants/routes/handleAuth" import { myPages } from "@/constants/routes/myPages" import { env } from "@/env/client" diff --git a/apps/scandic-web/components/Current/Preamble/renderOptions.tsx b/apps/scandic-web/components/Current/Preamble/renderOptions.tsx index 1c613cab2..99fe1a3c2 100644 --- a/apps/scandic-web/components/Current/Preamble/renderOptions.tsx +++ b/apps/scandic-web/components/Current/Preamble/renderOptions.tsx @@ -1,7 +1,8 @@ +import { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums" + import styles from "./preamble.module.css" import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml" -import { RTETypeEnum } from "@/types/rte/enums" import type { RTEDefaultNode, RTENext } from "@/types/rte/node" import type { RenderOptions } from "@/types/rte/option" diff --git a/apps/scandic-web/components/Current/currentRenderOptions.tsx b/apps/scandic-web/components/Current/currentRenderOptions.tsx index c184f5497..8d8715417 100644 --- a/apps/scandic-web/components/Current/currentRenderOptions.tsx +++ b/apps/scandic-web/components/Current/currentRenderOptions.tsx @@ -1,3 +1,8 @@ +import { + RTEItemTypeEnum, + RTETypeEnum, +} from "@scandic-hotels/trpc/types/RTEenums" + import Image from "@/components/Image" import Link from "@/components/TempDesignSystem/Link" @@ -6,7 +11,6 @@ import styles from "./currentRenderOptions.module.css" 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, RTEMarkType, diff --git a/apps/scandic-web/components/DatePicker/Range/Desktop.tsx b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx index 5e4653c25..cf792fa86 100644 --- a/apps/scandic-web/components/DatePicker/Range/Desktop.tsx +++ b/apps/scandic-web/components/DatePicker/Range/Desktop.tsx @@ -5,12 +5,11 @@ import { DayPicker } from "react-day-picker" import { useIntl } from "react-intl" import { Lang } from "@scandic-hotels/common/constants/language" +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 { dt } from "@/lib/dt" - import Button from "@/components/TempDesignSystem/Button" import Caption from "@/components/TempDesignSystem/Text/Caption" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/DatePicker/Range/Mobile.tsx b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx index 61e09286c..208a1a7a5 100644 --- a/apps/scandic-web/components/DatePicker/Range/Mobile.tsx +++ b/apps/scandic-web/components/DatePicker/Range/Mobile.tsx @@ -4,11 +4,10 @@ import { type DateRange, DayPicker } from "react-day-picker" import { useIntl } from "react-intl" import { Lang } from "@scandic-hotels/common/constants/language" +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 { dt } from "@/lib/dt" - import Button from "@/components/TempDesignSystem/Button" import Body from "@/components/TempDesignSystem/Text/Body" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/DatePicker/Single/Desktop.tsx b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx index 0cbad7005..3030d94c9 100644 --- a/apps/scandic-web/components/DatePicker/Single/Desktop.tsx +++ b/apps/scandic-web/components/DatePicker/Single/Desktop.tsx @@ -5,11 +5,10 @@ import { DayPicker } from "react-day-picker" import { useIntl } from "react-intl" import { Lang } from "@scandic-hotels/common/constants/language" +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 { dt } from "@/lib/dt" - import Button from "@/components/TempDesignSystem/Button" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" diff --git a/apps/scandic-web/components/DatePicker/Single/Mobile.tsx b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx index a1be77e60..0e52de12f 100644 --- a/apps/scandic-web/components/DatePicker/Single/Mobile.tsx +++ b/apps/scandic-web/components/DatePicker/Single/Mobile.tsx @@ -3,8 +3,7 @@ import { DayPicker } from "react-day-picker" import { useIntl } from "react-intl" import { Lang } from "@scandic-hotels/common/constants/language" - -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import Button from "@/components/TempDesignSystem/Button" import Body from "@/components/TempDesignSystem/Text/Body" diff --git a/apps/scandic-web/components/DatePicker/index.tsx b/apps/scandic-web/components/DatePicker/index.tsx index ab68d25ba..41ae16f70 100644 --- a/apps/scandic-web/components/DatePicker/index.tsx +++ b/apps/scandic-web/components/DatePicker/index.tsx @@ -3,8 +3,9 @@ import { useCallback, useEffect, useRef, useState } from "react" import { useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" + import { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import Body from "@/components/TempDesignSystem/Text/Body" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx index 80d6e9026..e34465e36 100644 --- a/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/DeprecatedJsonToHtml/renderOptions.tsx @@ -1,9 +1,14 @@ +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { Divider } from "@scandic-hotels/design-system/Divider" +import { + AvailableParagraphFormatEnum, + RTEItemTypeEnum, + RTETypeEnum, +} from "@scandic-hotels/trpc/types/RTEenums" +import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault" import Image from "@/components/Image" import Link from "@/components/TempDesignSystem/Link" -import { insertResponseToImageVaultAsset } from "@/utils/imageVault" -import { removeMultipleSlashes } from "@/utils/url" import ImageContainer from "../ImageContainer" import Table from "../TempDesignSystem/Table" @@ -17,15 +22,11 @@ import { hasAvailableParagraphFormat, hasAvailableULFormat } from "./utils" import styles from "./jsontohtml.module.css" +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" + import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml" -import type { ImageVaultAsset } from "@/types/components/imageVault" import { EmbedEnum } from "@/types/requests/utils/embeds" import type { Attributes, RTEImageVaultAttrs } from "@/types/rte/attrs" -import { - AvailableParagraphFormatEnum, - RTEItemTypeEnum, - RTETypeEnum, -} from "@/types/rte/enums" import { type RTEDefaultNode, type RTEImageNode, diff --git a/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx b/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx index 20db82776..ed8da1745 100644 --- a/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx +++ b/apps/scandic-web/components/DeprecatedJsonToHtml/utils.tsx @@ -1,15 +1,17 @@ import { cloneElement } from "react" -import { renderOptions } from "./renderOptions" - -import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml" -import type { Embeds } from "@/types/requests/embeds" -import type { Node } from "@/types/requests/utils/edges" import { AvailableParagraphFormatEnum, AvailableULFormatEnum, RTETypeEnum, -} from "@/types/rte/enums" +} from "@scandic-hotels/trpc/types/RTEenums" + +import { renderOptions } from "./renderOptions" + +import type { Node } from "@scandic-hotels/trpc/types/edges" + +import type { EmbedByUid } from "@/types/components/deprecatedjsontohtml" +import type { Embeds } from "@/types/requests/embeds" import { RTEMarkType, type RTENode, diff --git a/apps/scandic-web/components/DestinationFilterAndSort/Filter/index.tsx b/apps/scandic-web/components/DestinationFilterAndSort/Filter/index.tsx index 0a49ceda7..40bac2d54 100644 --- a/apps/scandic-web/components/DestinationFilterAndSort/Filter/index.tsx +++ b/apps/scandic-web/components/DestinationFilterAndSort/Filter/index.tsx @@ -11,7 +11,7 @@ import Checkbox from "./Checkbox" import styles from "./filter.module.css" -import type { CategorizedFilters } from "@/types/components/destinationFilterAndSort" +import type { CategorizedFilters } from "@scandic-hotels/trpc/types/destinationFilterAndSort" interface FilterProps { filters: CategorizedFilters diff --git a/apps/scandic-web/components/DestinationFilterAndSort/Sort/index.tsx b/apps/scandic-web/components/DestinationFilterAndSort/Sort/index.tsx index 410eef6ff..fcdf6b7ce 100644 --- a/apps/scandic-web/components/DestinationFilterAndSort/Sort/index.tsx +++ b/apps/scandic-web/components/DestinationFilterAndSort/Sort/index.tsx @@ -6,8 +6,9 @@ import { useDestinationDataStore } from "@/stores/destination-data" import DeprecatedSelect from "@/components/TempDesignSystem/DeprecatedSelect" +import type { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort" + import type { SortItem } from "@/types/components/destinationFilterAndSort" -import type { SortOption } from "@/types/enums/destinationFilterAndSort" interface SortProps { sortItems: SortItem[] diff --git a/apps/scandic-web/components/DestinationFilterAndSort/index.tsx b/apps/scandic-web/components/DestinationFilterAndSort/index.tsx index e72689390..cd2d78385 100644 --- a/apps/scandic-web/components/DestinationFilterAndSort/index.tsx +++ b/apps/scandic-web/components/DestinationFilterAndSort/index.tsx @@ -12,6 +12,7 @@ import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" import { useDestinationDataStore } from "@/stores/destination-data" @@ -25,8 +26,6 @@ import Sort from "./Sort" import styles from "./destinationFilterAndSort.module.css" -import { AlertTypeEnum } from "@/types/enums/alert" - interface HotelFilterAndSortProps { listType: "city" | "hotel" } diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx index 0a3ec00c1..9f5c7da63 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx @@ -4,12 +4,12 @@ import { usePathname } from "next/navigation" import { useFormContext, useWatch } from "react-hook-form" 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 "@/constants/booking" import { hotelreservation } from "@/constants/routes/hotelReservation" -import { dt } from "@/lib/dt" import DatePicker from "@/components/DatePicker" import GuestsRoomsPickerForm from "@/components/GuestsRoomsPicker" diff --git a/apps/scandic-web/components/Forms/BookingWidget/schema.ts b/apps/scandic-web/components/Forms/BookingWidget/schema.ts index 4d3d71468..189cf3a49 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/schema.ts +++ b/apps/scandic-web/components/Forms/BookingWidget/schema.ts @@ -1,8 +1,8 @@ import { z } from "zod" -import { REDEMPTION } from "@/constants/booking" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" +import { REDEMPTION } from "@/constants/booking" export const bookingWidgetErrors = { AGE_REQUIRED: "AGE_REQUIRED", diff --git a/apps/scandic-web/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx b/apps/scandic-web/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx index 1fc2030b4..fc4f357f9 100644 --- a/apps/scandic-web/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx +++ b/apps/scandic-web/components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx @@ -4,13 +4,13 @@ import { useFormContext } from "react-hook-form" import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import DeprecatedSelect from "@/components/TempDesignSystem/DeprecatedSelect" import Caption from "@/components/TempDesignSystem/Text/Caption" import styles from "./child-selector.module.css" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { ChildBed, ChildInfoSelectorProps, diff --git a/apps/scandic-web/components/GuestsRoomsPicker/GuestsRoom/index.tsx b/apps/scandic-web/components/GuestsRoomsPicker/GuestsRoom/index.tsx index 4aa4b82db..d3dc8f319 100644 --- a/apps/scandic-web/components/GuestsRoomsPicker/GuestsRoom/index.tsx +++ b/apps/scandic-web/components/GuestsRoomsPicker/GuestsRoom/index.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import Button from "@/components/TempDesignSystem/Button" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" @@ -11,7 +12,6 @@ import ChildSelector from "../ChildSelector" import styles from "../guests-rooms-picker.module.css" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker" export function GuestsRoom({ diff --git a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx index 899f00064..eda1f20f2 100644 --- a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx @@ -8,7 +8,8 @@ import { useMediaQuery } from "usehooks-ts" import { findMyBooking, findMyBookingCurrentWebPath, -} from "@/constants/routes/findMyBooking" +} from "@scandic-hotels/common/constants/routes/findMyBooking" + import { customerService } from "@/constants/webHrefs" import { env } from "@/env/client" import useDropdownStore from "@/stores/main-menu" diff --git a/apps/scandic-web/components/Header/MainMenu/MyPagesMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MyPagesMenu/index.tsx index b29de0d25..e7dec577f 100644 --- a/apps/scandic-web/components/Header/MainMenu/MyPagesMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MyPagesMenu/index.tsx @@ -19,9 +19,10 @@ import MyPagesMenuContent, { useMyPagesNavigation } from "../MyPagesMenuContent" import styles from "./myPagesMenu.module.css" +import type { LoyaltyLevel } from "@scandic-hotels/trpc/routers/contentstack/loyaltyLevel/output" + import { DropdownTypeEnum } from "@/types/components/dropdown/dropdown" import type { FriendsMembership, User } from "@/types/user" -import type { LoyaltyLevel } from "@/server/routers/contentstack/loyaltyLevel/output" export type MyPagesMenuProps = { user: Pick diff --git a/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx b/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx index 7480979ed..7a0bc2c12 100644 --- a/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MyPagesMenuWrapper/index.tsx @@ -3,7 +3,8 @@ import { useSession } from "next-auth/react" import { useIntl } from "react-intl" -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" + import { trpc } from "@/lib/trpc/client" import LoginButton from "@/components/LoginButton" diff --git a/apps/scandic-web/components/Header/TopMenu/index.tsx b/apps/scandic-web/components/Header/TopMenu/index.tsx index cd141a7d8..9e27b5981 100644 --- a/apps/scandic-web/components/Header/TopMenu/index.tsx +++ b/apps/scandic-web/components/Header/TopMenu/index.tsx @@ -1,7 +1,8 @@ import { findMyBooking, findMyBookingCurrentWebPath, -} from "@/constants/routes/findMyBooking" +} from "@scandic-hotels/common/constants/routes/findMyBooking" + import { env } from "@/env/server" import { getHeader } from "@/lib/trpc/memoizedRequests" diff --git a/apps/scandic-web/components/Headers/DynamicContent/index.tsx b/apps/scandic-web/components/Headers/DynamicContent/index.tsx index fdfa67fec..758f5f019 100644 --- a/apps/scandic-web/components/Headers/DynamicContent/index.tsx +++ b/apps/scandic-web/components/Headers/DynamicContent/index.tsx @@ -1,10 +1,11 @@ import { Suspense } from "react" +import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent" + import EmployeeBenefitsCallToActions from "@/components/DigitalTeamMemberCard/EmployeeBenefits/CallToActions" import LoadingSpinner from "@/components/LoadingSpinner" import type { HeaderDynamicContentProps } from "@/types/components/headers/dynamicContent" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" export default function HeaderDynamicContent(props: HeaderDynamicContentProps) { return ( diff --git a/apps/scandic-web/components/Hero/hero.ts b/apps/scandic-web/components/Hero/hero.ts index 07cc2cb1c..59ab7e8ac 100644 --- a/apps/scandic-web/components/Hero/hero.ts +++ b/apps/scandic-web/components/Hero/hero.ts @@ -1,4 +1,4 @@ -import type { FocalPoint } from "@/types/components/image" +import type { FocalPoint } from "@scandic-hotels/trpc/types/image" export interface HeroProps { alt: string diff --git a/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx b/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx index 4830d7543..a36aebfde 100644 --- a/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx +++ b/apps/scandic-web/components/HotelReservation/AddToCalendar/index.tsx @@ -2,7 +2,7 @@ import { createEvent } from "ics" import { useIntl } from "react-intl" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import { toast } from "@/components/TempDesignSystem/Toasts" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx index b8766c386..38df0c035 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/ManageBooking.tsx @@ -3,10 +3,9 @@ import { useEffect } from "react" import { useIntl } from "react-intl" +import { myStay } from "@scandic-hotels/common/constants/routes/myStay" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import { myStay } from "@/constants/routes/myStay" - import Button from "@/components/TempDesignSystem/Button" import Link from "@/components/TempDesignSystem/Link" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/helpers.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/helpers.ts index fe7cb78c7..791ecb0a6 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/helpers.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Header/Actions/helpers.ts @@ -1,4 +1,4 @@ -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import type { DateTime } from "ics" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/index.tsx index 65cad22fb..efa8c03ab 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/index.tsx @@ -1,5 +1,7 @@ "use client" -import { dt } from "@/lib/dt" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { dt } from "@scandic-hotels/common/dt" + import { useBookingConfirmationStore } from "@/stores/booking-confirmation" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" @@ -7,7 +9,6 @@ import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" import { mapToPrice } from "./mapToPrice" import type { Price } from "@/types/components/hotelReservation/price" -import { CurrencyEnum } from "@/types/enums/currency" export default function PriceDetails() { const { bookingCode, currency, fromDate, rooms, vat, toDate } = diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/mapToPrice.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/mapToPrice.ts index 6e11e6a24..48c760296 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/mapToPrice.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/PriceDetails/mapToPrice.ts @@ -1,12 +1,12 @@ +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" +import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages" import { breakfastPackageSchema, packageSchema, -} from "@/server/routers/hotels/schemas/packages" +} from "@scandic-hotels/trpc/routers/hotels/schemas/packages" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { PackageTypeEnum } from "@/types/enums/packages" import type { Package } from "@/types/requests/packages" import type { Room } from "@/types/stores/booking-confirmation" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Promos/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Promos/index.tsx index 13b37fc70..92f4725bb 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Promos/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Promos/index.tsx @@ -2,7 +2,7 @@ import { useEffect } from "react" import { useIntl } from "react-intl" -import { myStay } from "@/constants/routes/myStay" +import { myStay } from "@scandic-hotels/common/constants/routes/myStay" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx index 80d652089..cfef22d0f 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/Room/index.tsx @@ -7,8 +7,9 @@ import { Button } from "@scandic-hotels/design-system/Button" 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 { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" -import { CancellationRuleEnum, ChildBedTypeEnum } from "@/constants/booking" +import { CancellationRuleEnum } from "@/constants/booking" import { useBookingConfirmationStore } from "@/stores/booking-confirmation" import Modal from "@/components/Modal" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/index.tsx index 95bcd6140..fd250dccc 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Receipt/index.tsx @@ -2,12 +2,12 @@ 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 { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useBookingConfirmationStore } from "@/stores/booking-confirmation" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx index 56ab256b4..356cfb43b 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/LinkedReservation/index.tsx @@ -3,6 +3,8 @@ import { useEffect } from "react" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { trpc } from "@/lib/trpc/client" import { useBookingConfirmationStore } from "@/stores/booking-confirmation" @@ -15,7 +17,6 @@ import { LinkedReservationCardSkeleton } from "./LinkedReservationCardSkeleton" import Retry from "./Retry" import type { LinkedReservationProps } from "@/types/components/hotelReservation/bookingConfirmation/rooms/linkedReservation" -import { CurrencyEnum } from "@/types/enums/currency" export function LinkedReservation({ checkInTime, diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/Room/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/Room/index.tsx index d73fc9cca..311337a27 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Rooms/Room/index.tsx @@ -2,6 +2,7 @@ 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" @@ -10,7 +11,6 @@ import { changeOrCancelDateFormat, longDateFormat, } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import Image from "@/components/Image" import Caption from "@/components/TempDesignSystem/Text/Caption" diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts index a4c37f387..d9e6c30df 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/Tracking/tracking.ts @@ -1,5 +1,10 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { RateEnum } from "@scandic-hotels/trpc/enums/rate" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import { CancellationRuleEnum } from "@/constants/booking" import { readPaymentInfoFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/helpers" @@ -8,8 +13,8 @@ import { getSpecialRoomType } from "@/utils/specialRoomType" import { invertedBedTypeMap } from "../../utils" import type { Lang } from "@scandic-hotels/common/constants/language" +import type { RateDefinition } from "@scandic-hotels/trpc/types/roomAvailability" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import { TrackingChannelEnum, type TrackingSDKAncillaries, @@ -17,12 +22,8 @@ import { type TrackingSDKPageData, type TrackingSDKPaymentInfo, } from "@/types/components/tracking" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { CurrencyEnum } from "@/types/enums/currency" -import { RateEnum } from "@/types/enums/rate" import type { Room } from "@/types/stores/booking-confirmation" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" -import type { RateDefinition } from "@/types/trpc/routers/hotel/roomAvailability" function getRate(cancellationRule: RateDefinition["cancellationRule"] | null) { switch (cancellationRule) { diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx b/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx index c25150c94..dc545ec4b 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/index.tsx @@ -1,6 +1,7 @@ import { notFound } from "next/navigation" import { Divider } from "@scandic-hotels/design-system/Divider" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests" @@ -21,7 +22,6 @@ import { mapRoomState } from "./utils" import styles from "./bookingConfirmation.module.css" import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" -import { AlertTypeEnum } from "@/types/enums/alert" export default async function BookingConfirmation({ refId, diff --git a/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts b/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts index 8466d2686..5bc11e6f2 100644 --- a/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts +++ b/apps/scandic-web/components/HotelReservation/BookingConfirmation/utils.ts @@ -1,10 +1,11 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" + import { formatPrice } from "@/utils/numberFormatting" import type { IntlShape } from "react-intl" import type { BookingConfirmationRoom } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { CurrencyEnum } from "@/types/enums/currency" import type { BookingConfirmationSchema, PackageSchema, diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx index 44ef6061a..5a47124ca 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx @@ -7,6 +7,7 @@ import { useIntl } from "react-intl" import BreakfastBuffetIcon from "@scandic-hotels/design-system/Icons/BreakfastBuffetIcon" import NoBreakfastBuffetIcon from "@scandic-hotels/design-system/Icons/NoBreakfastBuffetIcon" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import { useEnterDetailsStore } from "@/stores/enter-details" @@ -21,7 +22,6 @@ import { breakfastFormSchema } from "./schema" import styles from "./breakfast.module.css" import type { BreakfastFormSchema } from "@/types/components/hotelReservation/breakfast" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" export default function Breakfast() { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx index 2bda79146..7b2004119 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Confirm/Guarantee/index.tsx @@ -9,12 +9,11 @@ import { import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { Button } from "@scandic-hotels/design-system/Button" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { PaymentMethodEnum } from "@/constants/booking" - import MySavedCards from "@/components/HotelReservation/MySavedCards" import PaymentOption from "@/components/HotelReservation/PaymentOption" import Checkbox from "@/components/TempDesignSystem/Form/Checkbox" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx index 097496df0..849fbb8ae 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/MemberPriceModal/index.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react" import { useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import MagicWandIcon from "@scandic-hotels/design-system/Icons/MagicWandIcon" import Modal from "@/components/Modal" @@ -16,8 +17,6 @@ import { formatPrice } from "@/utils/numberFormatting" import styles from "./modal.module.css" -import { CurrencyEnum } from "@/types/enums/currency" - export default function MemberPriceModal() { const { actions: { updatePriceForMembershipNo }, diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx index b7ee391de..9d75c41f2 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/Multiroom/JoinScandicFriendsCard/index.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Typography } from "@scandic-hotels/design-system/Typography" import { membershipTermsAndConditions } from "@/constants/webHrefs" @@ -16,7 +17,6 @@ import { formatPrice } from "@/utils/numberFormatting" import styles from "./joinScandicFriendsCard.module.css" import type { JoinScandicFriendsCardProps } from "@/types/components/hotelReservation/enterDetails/details" -import { CurrencyEnum } from "@/types/enums/currency" export default function JoinScandicFriendsCard({ name = "join", diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx index 82fe828db..17a3d67cd 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/JoinScandicFriendsCard/index.tsx @@ -1,6 +1,7 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Typography } from "@scandic-hotels/design-system/Typography" import { membershipTermsAndConditions } from "@/constants/webHrefs" @@ -17,7 +18,6 @@ import { formatPrice } from "@/utils/numberFormatting" import styles from "./joinScandicFriendsCard.module.css" import type { JoinScandicFriendsCardProps } from "@/types/components/hotelReservation/enterDetails/details" -import { CurrencyEnum } from "@/types/enums/currency" export default function JoinScandicFriendsCard({ name = "join", diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/schema.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/schema.ts index 14550b0db..706fd3a15 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/schema.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Details/RoomOne/schema.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import { specialRequestSchema } from "@/components/HotelReservation/EnterDetails/Details/SpecialRequests/schema" import { phoneValidator } from "@/utils/zod/phoneValidator" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx index dd25baae3..48751c1d0 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx @@ -4,6 +4,8 @@ import { usePathname, useSearchParams } from "next/navigation" import { useEffect, useRef, useState } from "react" import { useIntl } from "react-intl" +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" @@ -14,8 +16,6 @@ import useStickyPosition from "@/hooks/useStickyPosition" import styles from "./bookingAlert.module.css" -import { AlertTypeEnum } from "@/types/enums/alert" - function useBookingErrorAlert() { const updateSearchParams = useEnterDetailsStore( (state) => state.actions.updateSeachParamString diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx index 43b681963..3565daedb 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx @@ -8,13 +8,14 @@ import { Label } from "react-aria-components" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { Button } from "@scandic-hotels/design-system/Button" import { Typography } from "@scandic-hotels/design-system/Typography" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { BookingStatusEnum, PAYMENT_METHOD_TITLES, - PaymentMethodEnum, REDEMPTION, } from "@/constants/booking" import { @@ -60,7 +61,6 @@ import type { PaymentClientProps, PriceChangeData, } from "@/types/components/hotelReservation/enterDetails/payment" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" const maxRetries = 15 const retryInterval = 2000 diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/helpers.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/helpers.ts index 36cf6308c..75a4aa716 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/helpers.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/helpers.ts @@ -1,4 +1,4 @@ -import { PaymentMethodEnum } from "@/constants/booking" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import type { RoomState } from "@/types/stores/enter-details" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Room/Multiroom.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Room/Multiroom.tsx index 7c6800fa1..6d7c959e7 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Room/Multiroom.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Room/Multiroom.tsx @@ -1,6 +1,8 @@ "use client" import { useIntl } from "react-intl" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" + import { useEnterDetailsStore } from "@/stores/enter-details" import BedType from "@/components/HotelReservation/EnterDetails/BedType" @@ -14,7 +16,6 @@ import { useRoomContext } from "@/contexts/Details/Room" import { getBedTypeInfoText } from "./utils" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import { StepEnum } from "@/types/enums/step" export default function Multiroom() { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Room/One.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Room/One.tsx index bbd725af6..a57ca25ca 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Room/One.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Room/One.tsx @@ -1,6 +1,8 @@ "use client" import { useIntl } from "react-intl" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" + import { useEnterDetailsStore } from "@/stores/enter-details" import BedType from "@/components/HotelReservation/EnterDetails/BedType" @@ -14,7 +16,6 @@ import { useRoomContext } from "@/contexts/Details/Room" import { getBedTypeInfoText } from "./utils" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import { StepEnum } from "@/types/enums/step" import type { SafeUser } from "@/types/user" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx index 90d217fd0..8ae67d76a 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/Room/index.tsx @@ -5,6 +5,7 @@ import { Button } from "@scandic-hotels/design-system/Button" 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 { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import Modal from "@/components/Modal" import { formatPrice } from "@/utils/numberFormatting" @@ -14,8 +15,8 @@ import Breakfast from "./Breakfast" import styles from "./room.module.css" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" -import type { CurrencyEnum } from "@/types/enums/currency" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import type { Room as RoomType } from "@/types/stores/enter-details" interface RoomProps { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx index bc214435a..9d0008fde 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx @@ -4,12 +4,12 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" +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 { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import BookingCodeChip from "@/components/BookingCodeChip" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/index.tsx index d1a34f4cf..965da0a22 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/index.tsx @@ -8,9 +8,9 @@ import { useSearchHistory } from "@/hooks/useSearchHistory" import { getTracking } from "./tracking" import type { Lang } from "@scandic-hotels/common/constants/language" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" import type { DetailsBooking } from "@/types/components/hotelReservation/enterDetails/details" -import type { Hotel } from "@/types/hotel" import type { Room } from "@/types/providers/details/room" interface TrackingWrapperProps { diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts index 38a098bfd..d7472fcc4 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts @@ -1,34 +1,35 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +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 { + PriceProduct, + Product, +} from "@scandic-hotels/trpc/types/roomAvailability" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { BreakfastPackages } from "@/types/components/hotelReservation/breakfast" import type { DetailsBooking, RoomRate, } from "@/types/components/hotelReservation/enterDetails/details" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import { TrackingChannelEnum, type TrackingSDKAncillaries, type TrackingSDKHotelInfo, type TrackingSDKPageData, } from "@/types/components/tracking" -import { CurrencyEnum } from "@/types/enums/currency" -import { PackageTypeEnum } from "@/types/enums/packages" -import type { Hotel } from "@/types/hotel" import type { Room } from "@/types/providers/details/room" import type { RoomState } from "@/types/stores/enter-details" -import type { - PriceProduct, - Product, -} from "@/types/trpc/routers/hotel/roomAvailability" export function getTracking( booking: DetailsBooking, diff --git a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx index 03898aad8..61820b79e 100644 --- a/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/FindMyBooking/index.tsx @@ -5,7 +5,8 @@ import { useRouter } from "next/navigation" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" -import { myStay } from "@/constants/routes/myStay" +import { myStay } from "@scandic-hotels/common/constants/routes/myStay" + import { customerService } from "@/constants/webHrefs" import { trpc } from "@/lib/trpc/client" diff --git a/apps/scandic-web/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert.tsx b/apps/scandic-web/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert.tsx index 01462e869..f592381a1 100644 --- a/apps/scandic-web/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert.tsx +++ b/apps/scandic-web/components/HotelReservation/FnFNotAllowedAlert/FnFNotAllowedAlert.tsx @@ -1,10 +1,10 @@ +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import Alert from "@/components/TempDesignSystem/Alert" import { getIntl } from "@/i18n" import styles from "./FnFNotAllowedAlert.module.css" -import { AlertTypeEnum } from "@/types/enums/alert" - export default async function FnFNotAllowedAlert() { const intl = await getIntl() diff --git a/apps/scandic-web/components/HotelReservation/HotelCard/HotelChequeCard/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCard/HotelChequeCard/index.tsx index c40713e1a..7f44a345b 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCard/HotelChequeCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCard/HotelChequeCard/index.tsx @@ -1,11 +1,12 @@ import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import styles from "./hotelChequeCard.module.css" -import { CurrencyEnum } from "@/types/enums/currency" import type { ProductTypeCheque } from "@/types/trpc/routers/hotel/availability" export default function HotelChequeCard({ diff --git a/apps/scandic-web/components/HotelReservation/HotelCard/HotelPriceCard/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCard/HotelPriceCard/index.tsx index 71427f871..2932fd157 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCard/HotelPriceCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCard/HotelPriceCard/index.tsx @@ -2,6 +2,7 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" +import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" @@ -10,7 +11,6 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import styles from "./hotelPriceCard.module.css" import type { PriceCardProps } from "@/types/components/hotelReservation/selectHotel/priceCardProps" -import { RateTypeEnum } from "@/types/enums/rateType" export default function HotelPriceCard({ productTypePrices, diff --git a/apps/scandic-web/components/HotelReservation/HotelCard/HotelVoucherCard/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCard/HotelVoucherCard/index.tsx index 88805a680..7382c6c1c 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCard/HotelVoucherCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCard/HotelVoucherCard/index.tsx @@ -1,11 +1,12 @@ import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import styles from "./hotelVoucherCard.module.css" -import { CurrencyEnum } from "@/types/enums/currency" import type { ProductTypeVoucher } from "@/types/trpc/routers/hotel/availability" export default function HotelVoucherCard({ diff --git a/apps/scandic-web/components/HotelReservation/HotelCardListing/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCardListing/index.tsx index 377929e3b..5e550a2fa 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCardListing/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCardListing/index.tsx @@ -4,6 +4,8 @@ import { useSession } from "next-auth/react" import { useEffect, useMemo, useRef } from "react" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { useBookingCodeFilterStore } from "@/stores/bookingCode-filter" import { useHotelFilterStore } from "@/stores/hotel-filters" import { useHotelsMapStore } from "@/stores/hotels-map" @@ -23,7 +25,6 @@ import { type HotelCardListingProps, HotelCardListingTypeEnum, } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps" -import { AlertTypeEnum } from "@/types/enums/alert" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" export default function HotelCardListing({ diff --git a/apps/scandic-web/components/HotelReservation/MySavedCards/index.tsx b/apps/scandic-web/components/HotelReservation/MySavedCards/index.tsx index 8d2bca089..9616cfdd3 100644 --- a/apps/scandic-web/components/HotelReservation/MySavedCards/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MySavedCards/index.tsx @@ -1,15 +1,14 @@ import { useIntl } from "react-intl" -import { - PAYMENT_METHOD_TITLES, - type PaymentMethodEnum, -} from "@/constants/booking" +import { PAYMENT_METHOD_TITLES } from "@/constants/booking" import PaymentOptionsGroup from "../EnterDetails/Payment/PaymentOptionsGroup" 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" interface MySavedCardsProps { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx index 81266734a..c52b53fb9 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/ConfirmationStep/index.tsx @@ -1,12 +1,13 @@ import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" +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 { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" -import { PaymentMethodEnum } from "@/constants/booking" import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" -import { dt } from "@/lib/dt" import { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow" import PaymentOptionsGroup from "@/components/HotelReservation/EnterDetails/Payment/PaymentOptionsGroup" @@ -20,7 +21,6 @@ import useLang from "@/hooks/useLang" import styles from "./confirmationStep.module.css" import type { ConfirmationStepProps } from "@/types/components/myPages/myStay/ancillaries" -import { AlertTypeEnum } from "@/types/enums/alert" export default function ConfirmationStep({ savedCreditCards, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/index.tsx index 3bbf674ab..30a5edf73 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/index.tsx @@ -3,6 +3,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 { useAddAncillaryStore } from "@/stores/my-stay/add-ancillary-flow" @@ -14,7 +15,6 @@ import Body from "@/components/TempDesignSystem/Text/Body" import styles from "./selectQuantityStep.module.css" import type { SelectQuantityStepProps } from "@/types/components/myPages/myStay/ancillaries" -import { AlertTypeEnum } from "@/types/enums/alert" export default function SelectQuantityStep({ user }: SelectQuantityStepProps) { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx index fa804ed5d..5aafba266 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/index.tsx @@ -6,13 +6,14 @@ import { useEffect, useState } from "react" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" -import { PaymentMethodEnum } from "@/constants/booking" import { guaranteeCallback } from "@/constants/routes/hotelReservation" import { env } from "@/env/client" -import { dt } from "@/lib/dt" import { trpc } from "@/lib/trpc/client" import { AncillaryStepEnum, @@ -50,7 +51,6 @@ import type { AddAncillaryFlowModalProps, Packages, } from "@/types/components/myPages/myStay/ancillaries" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" export default function AddAncillaryFlowModal({ booking, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/schema.ts b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/schema.ts index 0e5e0300b..e2ed0d9c9 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/schema.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/schema.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" const quantitySchemaWithoutRefine = z.object({ quantityWithPoints: z.number().nullable(), diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx index 1a33acb42..9636c71b2 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx @@ -3,6 +3,7 @@ import { useIntl } from "react-intl" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import Accordion from "@/components/TempDesignSystem/Accordion" import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem" @@ -16,7 +17,6 @@ import RemoveButton from "./RemoveButton" import styles from "./addedAncillaries.module.css" import type { AddedAncillariesProps } from "@/types/components/myPages/myStay/ancillaries" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" import type { Room } from "@/types/stores/my-stay" import type { PackageSchema } from "@/types/trpc/routers/booking/confirmation" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/index.tsx index 1117e0c9c..4abe90fa5 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/index.tsx @@ -2,6 +2,8 @@ import { use } from "react" import { useIntl } from "react-intl" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" + import { useMyStayStore } from "@/stores/my-stay" import { Carousel } from "@/components/Carousel" @@ -21,7 +23,6 @@ import type { AncillariesProps, SelectedAncillary, } from "@/types/components/myPages/myStay/ancillaries" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" export function Ancillaries({ ancillariesPromise, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx index 435e6bfec..e5f21339f 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx @@ -12,7 +12,7 @@ import SummaryCard from "./SummaryCard" import styles from "./bookingSummary.module.css" -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" interface BookingSummaryProps { hotel: Hotel diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Header/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Header/index.tsx index 6b940b9c6..4a77ac2a9 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Header/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Header/index.tsx @@ -4,7 +4,7 @@ import { getIntl } from "@/i18n" import styles from "./header.module.css" -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export async function Header({ cityName, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/index.tsx index e5f78f322..04f3ec276 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/index.tsx @@ -1,5 +1,6 @@ "use client" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" + import { useMyStayStore } from "@/stores/my-stay" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts index 46113f0e9..c98f2e4cb 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/mapToPrice.ts @@ -1,10 +1,10 @@ -import { dt } from "@/lib/dt" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { dt } from "@scandic-hotels/common/dt" import { sumPackages } from "../../utils" import { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay" import type { Price } from "@/types/components/hotelReservation/price" -import { CurrencyEnum } from "@/types/enums/currency" import type { Room } from "@/types/stores/my-stay" export function mapToPrice(room: Room) { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx index 10dc86c4c..878089939 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Cheques.tsx @@ -1,13 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Typography } from "@scandic-hotels/design-system/Typography" import SkeletonShimmer from "@/components/SkeletonShimmer" import { formatPrice } from "@/utils/numberFormatting" -import { CurrencyEnum } from "@/types/enums/currency" - export default function Cheques({ cheques, currencyCode, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx index 0fd3b8554..d3212f32a 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Points.tsx @@ -1,13 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Typography } from "@scandic-hotels/design-system/Typography" import SkeletonShimmer from "@/components/SkeletonShimmer" import { formatPrice } from "@/utils/numberFormatting" -import { CurrencyEnum } from "@/types/enums/currency" - export default function Points({ isCancelled, points, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx index b3cd2aad5..7c8eae327 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceType/Vouchers.tsx @@ -1,13 +1,12 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Typography } from "@scandic-hotels/design-system/Typography" import SkeletonShimmer from "@/components/SkeletonShimmer" import { formatPrice } from "@/utils/numberFormatting" -import { CurrencyEnum } from "@/types/enums/currency" - export default function Vouchers({ currencyCode, isCancelled, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Footer/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Footer/index.tsx index 3da09241f..695958fd6 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Footer/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Footer/index.tsx @@ -1,7 +1,8 @@ +import { dt } from "@scandic-hotels/common/dt" import { Typography } from "@scandic-hotels/design-system/Typography" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { longDateWithYearFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" @@ -10,7 +11,6 @@ import { getNumberOfNights } from "@/utils/dateFormatting" import styles from "./footer.module.css" import type { FooterProps } from "@/types/components/hotelReservation/myStay/receipt" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" export default async function Footer({ booking, room }: FooterProps) { const intl = await getIntl() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx index 02c0500ef..e7345e7ab 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Specification/index.tsx @@ -1,5 +1,7 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { calculateVat } from "@/components/HotelReservation/utils" import { getIntl } from "@/i18n" @@ -7,8 +9,6 @@ import { getIntl } from "@/i18n" import styles from "./specification.module.css" import type { SpecificationProps } from "@/types/components/hotelReservation/myStay/receipt" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { CurrencyEnum } from "@/types/enums/currency" export default async function Specification({ ancillaryPackages, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Total/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Total/index.tsx index edf5ebe46..68d7eef9c 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Total/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/Total/index.tsx @@ -1,3 +1,4 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" @@ -6,7 +7,6 @@ import { getIntl } from "@/i18n" import styles from "./total.module.css" import type { TotalProps } from "@/types/components/hotelReservation/myStay/receipt" -import { CurrencyEnum } from "@/types/enums/currency" export default async function Total({ booking, currency }: TotalProps) { const intl = await getIntl() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/index.tsx index 50cf9f20f..4417f3fc5 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Receipt/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Receipt/index.tsx @@ -1,10 +1,11 @@ import { cookies } from "next/headers" import { notFound } from "next/navigation" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { dt } from "@scandic-hotels/common/dt" import ScandicLogoIcon from "@scandic-hotels/design-system/Icons/ScandicLogoIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { dt } from "@/lib/dt" import { findBooking, getAncillaryPackages, @@ -30,7 +31,6 @@ import Tracking from "./tracking" import styles from "./receipt.module.css" -import { CurrencyEnum } from "@/types/enums/currency" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" export async function Receipt({ refId }: { refId: string }) { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Alerts.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Alerts.tsx index dce1610f7..70af51ccc 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Alerts.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Alerts.tsx @@ -1,13 +1,13 @@ "use client" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" import Alert from "@/components/TempDesignSystem/Alert" -import { AlertTypeEnum } from "@/types/enums/alert" - interface AlertsProps extends React.PropsWithChildren { closeModal: () => void } diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx index 0e1097652..7f18316d0 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/CancelStayPriceContainer.tsx @@ -2,7 +2,8 @@ import { useWatch } from "react-hook-form" import { useIntl } from "react-intl" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" + import { useMyStayStore } from "@/stores/my-stay" import PriceContainer from "@/components/HotelReservation/MyStay/ReferenceCard/PriceContainer" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/Confirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/Confirmation/index.tsx index 484fd172b..8b041accb 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/Confirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/CancelStay/Steps/Confirmation/index.tsx @@ -2,10 +2,10 @@ import { useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Typography } from "@scandic-hotels/design-system/Typography" import { longDateWithYearFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/CannotChangeDate.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/CannotChangeDate.tsx index 217cb8202..bf1445537 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/CannotChangeDate.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/CannotChangeDate.tsx @@ -1,11 +1,11 @@ "use client" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import Modal from "@/components/HotelReservation/MyStay/Modal" import Alert from "@/components/TempDesignSystem/Alert" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function CannotChangeDate({ closeModal, }: { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/MultiRoomBooking.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/MultiRoomBooking.tsx index 33dd52785..6dd7c289c 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/MultiRoomBooking.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/MultiRoomBooking.tsx @@ -1,11 +1,11 @@ "use client" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import Modal from "@/components/HotelReservation/MyStay/Modal" import Alert from "@/components/TempDesignSystem/Alert" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function MultiRoomBooking({ closeModal, }: { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/NotMainRoom.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/NotMainRoom.tsx index a52521c99..603fbf6ce 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/NotMainRoom.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Alerts/NotMainRoom.tsx @@ -1,11 +1,11 @@ "use client" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import Modal from "@/components/HotelReservation/MyStay/Modal" import Alert from "@/components/TempDesignSystem/Alert" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function NotMainRoom({ closeModal, }: { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx index 7c2872d2e..c9711e4e2 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Confirmation/index.tsx @@ -1,10 +1,10 @@ "use client" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" import { longDateWithYearFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { trpc } from "@/lib/trpc/client" import { useMyStayStore } from "@/stores/my-stay" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/Alerts/NoAvailability.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/Alerts/NoAvailability.tsx index 96b8098ec..47c9baa3f 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/Alerts/NoAvailability.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/Alerts/NoAvailability.tsx @@ -1,9 +1,9 @@ "use client" import { useIntl } from "react-intl" -import Alert from "@/components/TempDesignSystem/Alert" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" -import { AlertTypeEnum } from "@/types/enums/alert" +import Alert from "@/components/TempDesignSystem/Alert" export default function NoAvailability() { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/NewDates/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/NewDates/index.tsx index b8f6ca74a..3cad85b84 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/NewDates/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/NewDates/index.tsx @@ -7,11 +7,11 @@ import { import { useFormContext, useWatch } from "react-hook-form" 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 { longDateWithYearFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import DatePickerSingleDesktop from "@/components/DatePicker/Single/Desktop" import DatePickerSingleMobile from "@/components/DatePicker/Single/Mobile" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx index 8c7c5cffe..7fff9caa8 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/Form/index.tsx @@ -3,7 +3,8 @@ import { zodResolver } from "@hookform/resolvers/zod" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" + import { useMyStayStore } from "@/stores/my-stay" import Modal from "@/components/HotelReservation/MyStay/Modal" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx index bb21575cd..e92fc5da1 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ChangeDates/Steps/index.tsx @@ -3,6 +3,8 @@ import { useSession } from "next-auth/react" import { useState } from "react" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { trpc } from "@/lib/trpc/client" import { useMyStayStore } from "@/stores/my-stay" @@ -15,7 +17,6 @@ import Confirmation from "./Confirmation" import Form from "./Form" import type { ChangeDatesStepsProps } from "@/types/components/hotelReservation/myStay/changeDates" -import { CurrencyEnum } from "@/types/enums/currency" interface Dates { fromDate: string diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx index a1cd01a1d..dc5e73f59 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/GuaranteeLateArrival/Form/index.tsx @@ -3,10 +3,10 @@ import { zodResolver } from "@hookform/resolvers/zod" import { FormProvider, useForm } from "react-hook-form" import { useIntl } from "react-intl" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" -import { PaymentMethodEnum } from "@/constants/booking" import { guaranteeCallback } from "@/constants/routes/hotelReservation" import { bookingTermsAndConditions, privacyPolicy } from "@/constants/webHrefs" import { env } from "@/env/client" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ViewAndPrintReceipt/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ViewAndPrintReceipt/index.tsx index f316bf689..ad234774c 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ViewAndPrintReceipt/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/ViewAndPrintReceipt/index.tsx @@ -1,11 +1,11 @@ "use client" import { useIntl } from "react-intl" +import { preliminaryReceipt } from "@scandic-hotels/common/constants/routes/myStay" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { CancellationRuleEnum } from "@/constants/booking" -import { preliminaryReceipt } from "@/constants/routes/myStay" import { useMyStayStore } from "@/stores/my-stay" import Link from "@/components/TempDesignSystem/Link" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/utils.ts b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/utils.ts index 5162f0410..ea85b4227 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/utils.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/NotCancelled/ManageStay/Actions/utils.ts @@ -1,4 +1,4 @@ -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" export function dateHasPassed(date: string, time: string) { const hour = dt(time, "HH:mm").hour() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Dates/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Dates/index.tsx index 32afd39b4..d04131dce 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Dates/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Dates/index.tsx @@ -1,11 +1,11 @@ "use client" 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 { shortDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useMyStayStore } from "@/stores/my-stay" import useLang from "@/hooks/useLang" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx index 15350f390..77f12330e 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/MultiRoom/Room.tsx @@ -1,14 +1,16 @@ "use client" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" 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 { RateEnum } from "@scandic-hotels/trpc/enums/rate" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { CancellationRuleEnum } from "@/constants/booking" import { changeOrCancelDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { IconForFeatureCode } from "@/components/HotelReservation/utils" import Image from "@/components/Image" @@ -24,8 +26,6 @@ import RoomDetailsSidePeek from "./RoomDetailsSidePeek" import styles from "./room.module.css" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { RateEnum } from "@/types/enums/rate" import type { Room } from "@/types/stores/my-stay" import type { SafeUser } from "@/types/user" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/ModifyBy.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/ModifyBy.tsx index aa4bdfcee..20f457c3a 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/ModifyBy.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/ModifyBy.tsx @@ -1,7 +1,8 @@ import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" + import { changeOrCancelDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useMyStayStore } from "@/stores/my-stay" import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx index 7e2b4a1e0..01b83daa0 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Packages.tsx @@ -1,11 +1,11 @@ import { useIntl } from "react-intl" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import { useMyStayStore } from "@/stores/my-stay" import Row from "./Row" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" - export default function Packages() { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Terms/Terms.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Terms/Terms.tsx index f7c4a8e36..1d4864cc2 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Terms/Terms.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Terms/Terms.tsx @@ -3,6 +3,7 @@ import { useIntl } from "react-intl" 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 { RateEnum } from "@scandic-hotels/trpc/enums/rate" import { CancellationRuleEnum } from "@/constants/booking" import { useMyStayStore } from "@/stores/my-stay" @@ -14,8 +15,6 @@ import Row from "../Row" import styles from "./terms.module.css" -import { RateEnum } from "@/types/enums/rate" - export default function Terms() { const intl = useIntl() const rateTitles = useRateTitles() diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx index 521dbbb68..c833bed8b 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Packages/index.tsx @@ -1,13 +1,13 @@ "use client" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import { useMyStayStore } from "@/stores/my-stay" import { IconForFeatureCode } from "@/components/HotelReservation/utils" import styles from "./packages.module.css" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" - export default function Packages() { const packages = useMyStayStore( (state) => diff --git a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx index 450f4848b..b7627299d 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx @@ -1,10 +1,11 @@ import { cookies } from "next/headers" import { notFound } from "next/navigation" +import { dt } from "@scandic-hotels/common/dt" import { Typography } from "@scandic-hotels/design-system/Typography" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import { env } from "@/env/server" -import { dt } from "@/lib/dt" import { findBooking, getAncillaryPackages, @@ -41,7 +42,6 @@ import styles from "./index.module.css" import type { Lang } from "@scandic-hotels/common/constants/language" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" import type { SafeUser } from "@/types/user" diff --git a/apps/scandic-web/components/HotelReservation/MyStay/utils.ts b/apps/scandic-web/components/HotelReservation/MyStay/utils.ts index b04380acd..e38ae7506 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/utils.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/utils.ts @@ -1,4 +1,6 @@ -import { CancellationRuleEnum, ChildBedTypeEnum } from "@/constants/booking" +import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" + +import { CancellationRuleEnum } from "@/constants/booking" export function formatChildBedPreferences({ childrenAges, diff --git a/apps/scandic-web/components/HotelReservation/MyStay/utils/hasBreakfastPackage.ts b/apps/scandic-web/components/HotelReservation/MyStay/utils/hasBreakfastPackage.ts index 7afb4090c..950b9df70 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/utils/hasBreakfastPackage.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/utils/hasBreakfastPackage.ts @@ -1,4 +1,4 @@ -import { BreakfastPackageEnum } from "@/types/enums/breakfast" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" export function hasBreakfastPackageFromBookingFlow( packages: { diff --git a/apps/scandic-web/components/HotelReservation/MyStay/utils/mapRoomDetails.ts b/apps/scandic-web/components/HotelReservation/MyStay/utils/mapRoomDetails.ts index 2566743f0..c644d1b70 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/utils/mapRoomDetails.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/utils/mapRoomDetails.ts @@ -1,16 +1,18 @@ +import { dt } from "@scandic-hotels/common/dt" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import { BookingStatusEnum, CancellationRuleEnum } from "@/constants/booking" -import { dt } from "@/lib/dt" import { convertToChildType } from "../../utils/convertToChildType" import { getPriceType } from "../../utils/getPriceType" import { formatChildBedPreferences } from "../utils" +import type { RateEnum } from "@scandic-hotels/trpc/enums/rate" +import type { Room } from "@scandic-hotels/trpc/types/hotel" + import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { PackageTypeEnum } from "@/types/enums/packages" -import type { RateEnum } from "@/types/enums/rate" -import type { Room } from "@/types/hotel" import type { Room as MyStayRoom } from "@/types/stores/my-stay" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" diff --git a/apps/scandic-web/components/HotelReservation/PaymentOption/index.tsx b/apps/scandic-web/components/HotelReservation/PaymentOption/index.tsx index 4c122cb14..b9b8c58f9 100644 --- a/apps/scandic-web/components/HotelReservation/PaymentOption/index.tsx +++ b/apps/scandic-web/components/HotelReservation/PaymentOption/index.tsx @@ -2,16 +2,15 @@ import { cx } from "class-variance-authority" import Image from "next/image" import { Radio } from "react-aria-components" -import { - PAYMENT_METHOD_ICONS, - type PaymentMethodEnum, -} from "@/constants/booking" +import { PAYMENT_METHOD_ICONS } from "@/constants/booking" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import styles from "./paymentOption.module.css" +import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" + import type { PaymentOptionProps } from "./paymentOption" export default function PaymentOption({ diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx index 09de145c8..7c0e0403f 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/CorporateCheque.tsx @@ -1,6 +1,8 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { formatPrice } from "@/utils/numberFormatting" import BoldRow from "../Bold" @@ -8,7 +10,6 @@ import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" -import { CurrencyEnum } from "@/types/enums/currency" import type { SharedPriceRowProps } from "./price" export interface CorporateChequePriceType { diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx index 944c0b700..476984dc3 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Redemption.tsx @@ -1,6 +1,8 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { formatPrice } from "@/utils/numberFormatting" import BoldRow from "../Bold" @@ -8,7 +10,6 @@ import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" -import { CurrencyEnum } from "@/types/enums/currency" import type { SharedPriceRowProps } from "./price" export interface RedemptionPriceType { diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx index 3ae29e13f..2a78c3d64 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Regular.tsx @@ -8,7 +8,8 @@ import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" -import type { CurrencyEnum } from "@/types/enums/currency" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import type { SharedPriceRowProps } from "./price" export interface RegularPriceType { diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx index 3a126c176..342293057 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Price/Voucher.tsx @@ -1,6 +1,8 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { formatPrice } from "@/utils/numberFormatting" import BoldRow from "../Bold" @@ -8,7 +10,6 @@ import RegularRow from "../Regular" import BedTypeRow from "./BedType" import PackagesRow from "./Packages" -import { CurrencyEnum } from "@/types/enums/currency" import type { SharedPriceRowProps } from "./price" export interface VoucherPriceType { diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx index 5e27fc94f..096bd2b27 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/Row/Vat.tsx @@ -1,13 +1,14 @@ "use client" import { useIntl } from "react-intl" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { calculateVat } from "@/components/HotelReservation/utils" import { formatPrice } from "@/utils/numberFormatting" import RegularRow from "./Regular" import type { Price } from "@/types/components/hotelReservation/price" -import { CurrencyEnum } from "@/types/enums/currency" interface VatProps { totalPrice: Price diff --git a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/index.tsx b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/index.tsx index 4e7da9800..bf6c625ef 100644 --- a/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/index.tsx +++ b/apps/scandic-web/components/HotelReservation/PriceDetailsModal/PriceDetailsTable/index.tsx @@ -2,10 +2,10 @@ import { Fragment } from "react" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Typography } from "@scandic-hotels/design-system/Typography" import { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import useLang from "@/hooks/useLang" @@ -26,13 +26,14 @@ import Tbody from "./Tbody" import styles from "./priceDetailsTable.module.css" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +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 { CurrencyEnum } from "@/types/enums/currency" import type { Packages } from "@/types/requests/packages" -import type { RateDefinition } from "@/types/trpc/routers/hotel/roomAvailability" type RoomPrice = | CorporateChequePriceType diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/FilterContent/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/FilterContent/index.tsx index f4cf7cfaa..f4eca070c 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/FilterContent/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/FilterContent/index.tsx @@ -10,12 +10,12 @@ import FilterCheckbox from "./FilterCheckbox" import styles from "./filterContent.module.css" import type { - CategorizedFilters, + CategorizedHotelFilters, HotelFilter, } from "@/types/components/hotelReservation/selectHotel/hotelFilters" interface FilterContentProps { - filters: CategorizedFilters + filters: CategorizedHotelFilters activeFilters: string[] onChange: (id: string) => void onFilteredCountChange?: (count: number) => void diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/HotelFilter/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/HotelFilter/index.tsx index 7afc7e3e2..83b7efa21 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/HotelFilter/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/Filters/HotelFilter/index.tsx @@ -10,10 +10,7 @@ import { trackEvent } from "@/utils/tracking/base" import FilterContent from "../FilterContent" -import type { - HotelFilter, - HotelFiltersProps, -} from "@/types/components/hotelReservation/selectHotel/hotelFilters" +import type { HotelFiltersProps } from "@/types/components/hotelReservation/selectHotel/hotelFilters" export default function HotelFilter({ className, filters }: HotelFiltersProps) { const searchParams = useSearchParams() diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/MobileMapButtonContainer/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/MobileMapButtonContainer/index.tsx index bf907adb0..4c3e38ec8 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/MobileMapButtonContainer/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/MobileMapButtonContainer/index.tsx @@ -17,13 +17,13 @@ import FilterAndSortModal from "../Filters/FilterAndSortModal" import styles from "./mobileMapButtonContainer.module.css" -import type { CategorizedFilters } from "@/types/components/hotelReservation/selectHotel/hotelFilters" +import type { CategorizedHotelFilters } from "@/types/components/hotelReservation/selectHotel/hotelFilters" export default function MobileMapButtonContainer({ filters, isAlternative, }: { - filters: CategorizedFilters + filters: CategorizedHotelFilters isAlternative?: boolean }) { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/NoAvailabilityAlert.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/NoAvailabilityAlert.tsx index 770b5f5a0..6e92a129a 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/NoAvailabilityAlert.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/NoAvailabilityAlert.tsx @@ -1,3 +1,5 @@ +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { alternativeHotels } from "@/constants/routes/hotelReservation" import Alert from "@/components/TempDesignSystem/Alert" @@ -5,7 +7,6 @@ import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import type { NoAvailabilityAlertProp } from "@/types/components/hotelReservation/selectHotel/noAvailabilityAlert" -import { AlertTypeEnum } from "@/types/enums/alert" export default async function NoAvailabilityAlert({ hotelsLength, diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts index 7c0921682..593ec78c7 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/SelectHotelMap/tracking.ts @@ -1,8 +1,9 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" + import type { Lang } from "@scandic-hotels/common/constants/language" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import { TrackingChannelEnum, type TrackingSDKHotelInfo, diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/helpers.ts b/apps/scandic-web/components/HotelReservation/SelectHotel/helpers.ts index c96bcd48e..080ce82ea 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/helpers.ts +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/helpers.ts @@ -1,3 +1,5 @@ +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" + import { getHotel } from "@/lib/trpc/memoizedRequests" import { serverClient } from "@/lib/trpc/server" @@ -5,22 +7,22 @@ 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 { AlternativeHotelsAvailabilityInput, AvailabilityInput, } from "@/types/components/hotelReservation/selectHotel/availabilityInput" import type { - CategorizedFilters, + CategorizedHotelFilters, HotelFilter, } from "@/types/components/hotelReservation/selectHotel/hotelFilters" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" -import type { AdditionalData, Hotel } from "@/types/hotel" import type { HotelsAvailabilityItem } from "@/types/trpc/routers/hotel/availability" -import type { - HotelLocation, - Location, -} from "@/types/trpc/routers/hotel/locations" interface AvailabilityResponse { availability: HotelsAvailabilityItem[] @@ -263,7 +265,7 @@ const hotelFacilitiesFilterNames = [ export function getFiltersFromHotels( hotels: HotelResponse[] -): CategorizedFilters { +): CategorizedHotelFilters { const defaultFilters = { facilityFilters: [], surroundingsFilters: [] } if (!hotels.length) { return defaultFilters @@ -296,7 +298,7 @@ export function getFiltersFromHotels( .filter((filter): filter is HotelFilter => filter !== undefined) .sort((a, b) => b.sortOrder - a.sortOrder) - return filterList.reduce((filters, filter) => { + return filterList.reduce((filters, filter) => { if (filter.filter && hotelSurroundingsFilterNames.includes(filter.filter)) { filters.surroundingsFilters.push(filter) } diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx index 1111899c6..b758a4586 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx @@ -16,7 +16,7 @@ import { getFiltersFromHotels, type HotelResponse } from "./helpers" import styles from "./selectHotel.module.css" -import type { Location } from "@/types/trpc/routers/hotel/locations" +import type { Location } from "@scandic-hotels/trpc/types/locations" interface SelectHotelProps { isAlternative?: boolean diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/tracking.ts b/apps/scandic-web/components/HotelReservation/SelectHotel/tracking.ts index cd42d2681..66a340fb6 100644 --- a/apps/scandic-web/components/HotelReservation/SelectHotel/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/SelectHotel/tracking.ts @@ -1,8 +1,9 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" + import type { Lang } from "@scandic-hotels/common/constants/language" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import { TrackingChannelEnum, type TrackingSDKHotelInfo, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/HotelDescription/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/HotelDescription/index.tsx index f00f3999e..30a3fdcb4 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/HotelDescription/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/HotelDescription/index.tsx @@ -12,8 +12,9 @@ import Alert from "@/components/TempDesignSystem/Alert" import styles from "./hotelDescription.module.css" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" + import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek" -import type { Hotel } from "@/types/hotel" export default function HotelDescription({ description, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx index 4e32cd25e..6b2aa383a 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/HotelInfoCard/index.tsx @@ -1,8 +1,7 @@ +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" import { Typography } from "@scandic-hotels/design-system/Typography" -import { dt } from "@/lib/dt" - import { FacilityToIcon } from "@/components/ContentType/HotelPage/data" import ImageGallery from "@/components/ImageGallery" import SkeletonShimmer from "@/components/SkeletonShimmer" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx index ce44b979c..8dcfaccb6 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Content/index.tsx @@ -2,13 +2,13 @@ import { cx } from "class-variance-authority" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" 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 { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useRatesStore } from "@/stores/select-rate" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx index dcac19000..02790944f 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Room/index.tsx @@ -5,6 +5,7 @@ import { Button } from "@scandic-hotels/design-system/Button" 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 { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import Modal from "@/components/Modal" import { formatPrice } from "@/utils/numberFormatting" @@ -13,7 +14,6 @@ import { getMemberPrice, isBookingCodeRate } from "../utils" import styles from "./room.module.css" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { RoomPrice, RoomRate, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx index 184e09bba..e40c47fdc 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/Summary.tsx @@ -3,12 +3,13 @@ import { Fragment } from "react" import { Button as ButtonRAC } from "react-aria-components" import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Button } from "@scandic-hotels/design-system/Button" import { Divider } from "@scandic-hotels/design-system/Divider" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import { longDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import { useRatesStore } from "@/stores/select-rate" import PriceDetailsModal from "@/components/HotelReservation/PriceDetailsModal" @@ -25,7 +26,6 @@ import { isBookingCodeRate } from "./utils" import styles from "./summary.module.css" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import type { RoomRate } from "@/types/components/hotelReservation/enterDetails/details" import type { SelectRateSummaryProps } from "@/types/components/hotelReservation/summary" diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx index 3f49e9044..de2d3fb7f 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/index.tsx @@ -18,8 +18,9 @@ import { isBookingCodeRate } from "./utils" import styles from "./mobileSummary.module.css" +import type { RoomsAvailability } from "@scandic-hotels/trpc/types/roomAvailability" + import type { MobileSummaryProps } from "@/types/components/hotelReservation/selectRate/rateSummary" -import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability" export default function MobileSummary({ isAllRoomsSelected, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts index dbe86e018..051fd7b0e 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/mapRate.ts @@ -1,9 +1,10 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import type { Price } from "@/types/components/hotelReservation/price" import type { Rate, Room, } from "@/types/components/hotelReservation/selectRate/selectRate" -import { CurrencyEnum } from "@/types/enums/currency" import type { Packages } from "@/types/requests/packages" export function mapRate( diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts index c18caec68..ee5f420f2 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/MobileSummary/utils.ts @@ -1,6 +1,8 @@ +import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" + +import type { Product } from "@scandic-hotels/trpc/types/roomAvailability" + import type { RoomRate } from "@/types/components/hotelReservation/enterDetails/details" -import { RateTypeEnum } from "@/types/enums/rateType" -import type { Product } from "@/types/trpc/routers/hotel/roomAvailability" export function getMemberPrice(roomRate: RoomRate) { if ("member" in roomRate && roomRate.member) { diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx index 7c58de316..152b48256 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/RateSummary/index.tsx @@ -4,7 +4,10 @@ import { useSession } from "next-auth/react" import { useState, useTransition } from "react" import { useIntl } from "react-intl" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" +import { RateEnum } from "@scandic-hotels/trpc/enums/rate" +import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" + import { useRatesStore } from "@/stores/select-rate" import SignupPromoDesktop from "@/components/HotelReservation/SignupPromo/Desktop" @@ -21,9 +24,6 @@ import { getTotalPrice } from "./utils" import styles from "./rateSummary.module.css" -import { RateEnum } from "@/types/enums/rate" -import { RateTypeEnum } from "@/types/enums/rateType" - export default function RateSummary() { const { bookingCode, @@ -341,7 +341,7 @@ export default function RateSummary() { )} {showStrikedThroughPrice && - totalPriceToShow.local.regularPrice ? ( + totalPriceToShow.local.regularPrice ? ( ({ diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx index 54658b1c2..fc8490879 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/NoAvailabilityAlert/index.tsx @@ -1,6 +1,9 @@ "use client" import { useIntl } from "react-intl" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { alternativeHotels } from "@/constants/routes/hotelReservation" import { useRatesStore } from "@/stores/select-rate" @@ -10,9 +13,6 @@ import useLang from "@/hooks/useLang" import styles from "./alert.module.css" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function NoAvailabilityAlert() { const lang = useLang() const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx index 56eaaf857..8f89c0121 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/BookingCodeFilter/index.tsx @@ -17,6 +17,7 @@ import { ChipButton } from "@scandic-hotels/design-system/ChipButton" 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 { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" import { trpc } from "@/lib/trpc/client" import { useRatesStore } from "@/stores/select-rate" @@ -27,7 +28,6 @@ import useLang from "@/hooks/useLang" import styles from "./bookingCodeFilter.module.css" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" -import { RateTypeEnum } from "@/types/enums/rateType" export default function BookingCodeFilter() { const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/utils.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/utils.ts index 073f0fa14..2dde3b87a 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/utils.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/Form/Checkboxes/utils.ts @@ -1,4 +1,5 @@ -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import type { PackageEnum } from "@/types/requests/packages" export function includesAllergyRoom(codes: PackageEnum[]) { diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/utils.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/utils.ts index f153b7068..a243bc275 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/utils.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/RoomPackageFilter/utils.ts @@ -1,6 +1,7 @@ +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import type { MaterialSymbolProps } from "@scandic-hotels/design-system/Icons/MaterialIcon/MaterialSymbol" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { PackageEnum } from "@/types/requests/packages" export function getIconNameByPackageCode( diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx index b0b46514c..8520859e3 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsHeader/index.tsx @@ -2,6 +2,7 @@ import { useIntl } from "react-intl" import { Typography } from "@scandic-hotels/design-system/Typography" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { useRoomContext } from "@/contexts/SelectRate/Room" @@ -10,8 +11,6 @@ import RoomPackageFilter from "./RoomPackageFilter" import styles from "./roomsHeader.module.css" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" - export default function RoomsHeader() { const { isFetchingPackages, rooms, totalRooms } = useRoomContext() const intl = useIntl() diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/getBreakfastMessage.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/getBreakfastMessage.ts index 9ce1ae7d6..7d085a619 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/getBreakfastMessage.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/BreakfastMessage/getBreakfastMessage.ts @@ -1,4 +1,4 @@ -import { HotelTypeEnum } from "@/types/enums/hotelType" +import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" export function getBreakfastMessage( publicBreakfastIncluded: boolean, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx index 568ae6888..226c23c83 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Campaign.tsx @@ -16,9 +16,10 @@ import { isValidClientSession } from "@/utils/clientSession" import { isSelectedPriceProduct } from "./isSelected" import { calculatePricePerNightPriceProduct } from "./totalPricePerNight" +import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability" + import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" -import type { PriceProduct } from "@/types/trpc/routers/hotel/roomAvailability" interface CampaignProps extends SharedRateCardProps { campaign: PriceProduct[] diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx index fecbc285f..8bd9b3f0e 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx @@ -20,8 +20,9 @@ import { } from "./isSelected" import { calculatePricePerNightPriceProduct } from "./totalPricePerNight" +import type { CodeProduct } from "@scandic-hotels/trpc/types/roomAvailability" + import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates" -import type { CodeProduct } from "@/types/trpc/routers/hotel/roomAvailability" interface CodeProps extends SharedRateCardProps { code: CodeProduct[] diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx index f550cbd40..fbb87b572 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Redemptions.tsx @@ -7,9 +7,10 @@ import { sumPackages } from "@/components/HotelReservation/utils" import { useRoomContext } from "@/contexts/SelectRate/Room" import useRateTitles from "@/hooks/booking/useRateTitles" +import type { RedemptionProduct } from "@scandic-hotels/trpc/types/roomAvailability" + import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" -import type { RedemptionProduct } from "@/types/trpc/routers/hotel/roomAvailability" interface RedemptionsProps extends SharedRateCardProps { redemptions: RedemptionProduct[] diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx index 2ba1be463..6f7169ff5 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Regular.tsx @@ -16,9 +16,10 @@ import { isValidClientSession } from "@/utils/clientSession" import { isSelectedPriceProduct } from "./isSelected" import { calculatePricePerNightPriceProduct } from "./totalPricePerNight" +import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability" + import type { SharedRateCardProps } from "@/types/components/hotelReservation/selectRate/rates" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" -import type { PriceProduct } from "@/types/trpc/routers/hotel/roomAvailability" interface Rate { label: string diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx index 4ed33e76e..48107a889 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/index.tsx @@ -2,9 +2,9 @@ import { useSession } from "next-auth/react" +import { dt } from "@scandic-hotels/common/dt" import { Divider } from "@scandic-hotels/design-system/Divider" -import { dt } from "@/lib/dt" import { useRatesStore } from "@/stores/select-rate" import SkeletonShimmer from "@/components/SkeletonShimmer" @@ -17,9 +17,10 @@ import Code from "./Code" import Redemptions from "./Redemptions" import Regular from "./Regular" +import type { Product } from "@scandic-hotels/trpc/types/roomAvailability" + import type { RatesProps } from "@/types/components/hotelReservation/selectRate/rates" import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" -import type { Product } from "@/types/trpc/routers/hotel/roomAvailability" export default function Rates({ roomConfiguration: { diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts index f1930b45f..759ff1ee2 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/isSelected.ts @@ -1,9 +1,10 @@ -import type { SelectedRate } from "@/types/stores/rates" import type { CorporateChequeProduct, PriceProduct, VoucherProduct, -} from "@/types/trpc/routers/hotel/roomAvailability" +} from "@scandic-hotels/trpc/types/roomAvailability" + +import type { SelectedRate } from "@/types/stores/rates" export function isSelectedPriceProduct( product: PriceProduct, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx index 4538fb119..80c639ff1 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/index.tsx @@ -1,5 +1,7 @@ "use client" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" + import { useRoomContext } from "@/contexts/SelectRate/Room" import Details from "./Details" @@ -10,7 +12,6 @@ import RoomNotAvailable from "./RoomNotAvailable" import styles from "./roomListItem.module.css" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" import type { RoomListItemProps } from "@/types/components/hotelReservation/selectRate/roomListItem" export default function RoomListItem({ roomConfiguration }: RoomListItemProps) { diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx index 157f2210e..fdc6b10ce 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/index.tsx @@ -13,7 +13,7 @@ import RoomsList from "./RoomsList" import styles from "./rooms.module.css" -import type { PriceProduct } from "@/types/trpc/routers/hotel/roomAvailability" +import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability" export default function Rooms() { const { diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx index 4264d66cd..1b1a1fb12 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/index.tsx @@ -3,8 +3,10 @@ import { notFound, useSearchParams } from "next/navigation" import { useIntl } from "react-intl" +import { selectRateRoomsAvailabilityInputSchema } from "@scandic-hotels/trpc/routers/hotels/input" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { trpc } from "@/lib/trpc/client" -import { selectRateRoomsAvailabilityInputSchema } from "@/server/routers/hotels/input" import Alert from "@/components/TempDesignSystem/Alert" import useLang from "@/hooks/useLang" @@ -18,7 +20,6 @@ import { RoomsContainerSkeleton } from "./RoomsContainerSkeleton" import styles from "./index.module.css" import type { RoomsContainerProps } from "@/types/components/hotelReservation/selectRate/roomsContainer" -import { AlertTypeEnum } from "@/types/enums/alert" export function RoomsContainer({ hotelType, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts index a913702a4..e1b1bff95 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/tracking.ts @@ -1,9 +1,10 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" + import type { Lang } from "@scandic-hotels/common/constants/language" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { Room } from "@/types/components/hotelReservation/selectRate/selectRate" import { TrackingChannelEnum, diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/getValidDates.ts b/apps/scandic-web/components/HotelReservation/SelectRate/getValidDates.ts index eb879052d..a883fd8ba 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/getValidDates.ts +++ b/apps/scandic-web/components/HotelReservation/SelectRate/getValidDates.ts @@ -1,4 +1,4 @@ -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import type { Dayjs } from "dayjs" diff --git a/apps/scandic-web/components/HotelReservation/utils/convertToChildType.ts b/apps/scandic-web/components/HotelReservation/utils/convertToChildType.ts index 320a1a29d..0289ff8c1 100644 --- a/apps/scandic-web/components/HotelReservation/utils/convertToChildType.ts +++ b/apps/scandic-web/components/HotelReservation/utils/convertToChildType.ts @@ -1,4 +1,5 @@ -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" +import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" + import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" diff --git a/apps/scandic-web/components/HotelReservation/utils/index.tsx b/apps/scandic-web/components/HotelReservation/utils/index.tsx index a6dc9b113..839651e91 100644 --- a/apps/scandic-web/components/HotelReservation/utils/index.tsx +++ b/apps/scandic-web/components/HotelReservation/utils/index.tsx @@ -2,14 +2,14 @@ import { MaterialIcon, type MaterialIconSetIconProps, } from "@scandic-hotels/design-system/Icons/MaterialIcon" - -import { ChildBedTypeEnum } from "@/constants/booking" +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 { JSX } from "react" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" import { - RoomPackageCodeEnum, + // RoomPackageCodeEnum, type RoomPackageCodes, } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" diff --git a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx index 9bb33a0b7..ed1e3386c 100644 --- a/apps/scandic-web/components/JsonToHtml/renderOptions.tsx +++ b/apps/scandic-web/components/JsonToHtml/renderOptions.tsx @@ -3,10 +3,11 @@ import { cx } from "class-variance-authority" 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 { ContentEnum } from "@scandic-hotels/trpc/types/content" +import { insertResponseToImageVaultAsset } from "@scandic-hotels/trpc/utils/imageVault" import Image from "@/components/Image" import Link from "@/components/TempDesignSystem/Link" -import { insertResponseToImageVaultAsset } from "@/utils/imageVault" import ImageContainer from "../ImageContainer" import Table from "../TempDesignSystem/Table" @@ -18,7 +19,6 @@ import { import styles from "./jsontohtml.module.css" -import { ContentEnum } from "@/types/enums/content" import type { EmbedByUid } from "@/types/transitionTypes/jsontohtml" import type { Attributes, diff --git a/apps/scandic-web/components/JsonToHtml/utils.tsx b/apps/scandic-web/components/JsonToHtml/utils.tsx index 1e9ef3bec..a52a9ae3b 100644 --- a/apps/scandic-web/components/JsonToHtml/utils.tsx +++ b/apps/scandic-web/components/JsonToHtml/utils.tsx @@ -4,7 +4,9 @@ import { renderOptions } from "./renderOptions" import styles from "./jsontohtml.module.css" -import type { Node } from "@/types/requests/utils/edges" +import type { Node } from "@scandic-hotels/trpc/types/edges" +import type { Embeds } from "@scandic-hotels/trpc/types/embeds" + import type { EmbedByUid } from "@/types/transitionTypes/jsontohtml" import { AvailableParagraphFormatEnum, @@ -19,7 +21,6 @@ import { type RTETextNode, } from "@/types/transitionTypes/rte/node" import type { RenderOptions } from "@/types/transitionTypes/rte/option" -import type { Embeds } from "@/types/trpc/routers/utils/embeds" export function groupEmbedsByUid(embedsArray: Node[]) { const embedsByUid = embedsArray.reduce((acc, embed) => { diff --git a/apps/scandic-web/components/Levels/Icon.tsx b/apps/scandic-web/components/Levels/Icon.tsx index 21ef0199e..8b0045603 100644 --- a/apps/scandic-web/components/Levels/Icon.tsx +++ b/apps/scandic-web/components/Levels/Icon.tsx @@ -1,4 +1,4 @@ -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" import { BestFriend, diff --git a/apps/scandic-web/components/Maps/InteractiveMap/PoiMapMarkers/index.tsx b/apps/scandic-web/components/Maps/InteractiveMap/PoiMapMarkers/index.tsx index 233f4ca8f..f771c051a 100644 --- a/apps/scandic-web/components/Maps/InteractiveMap/PoiMapMarkers/index.tsx +++ b/apps/scandic-web/components/Maps/InteractiveMap/PoiMapMarkers/index.tsx @@ -12,7 +12,16 @@ import PoiMarker from "../../Markers/Poi" import styles from "./poiMapMarkers.module.css" -import type { PoiMapMarkersProps } from "@/types/hotel" +import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" +import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker" + +export type PoiMapMarkersProps = { + activePoi?: string | null + coordinates: { lat: number; lng: number } + onActivePoiChange?: (poiName: string | null) => void + pointsOfInterest: PointOfInterest[] + markerInfo: MarkerInfo +} export default function PoiMapMarkers({ coordinates, diff --git a/apps/scandic-web/components/Maps/Markers/Poi/variants.ts b/apps/scandic-web/components/Maps/Markers/Poi/variants.ts index bdf328b8a..614cb69dd 100644 --- a/apps/scandic-web/components/Maps/Markers/Poi/variants.ts +++ b/apps/scandic-web/components/Maps/Markers/Poi/variants.ts @@ -1,8 +1,8 @@ import { cva } from "class-variance-authority" -import styles from "./poi.module.css" +import { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest" -import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest" +import styles from "./poi.module.css" export const poiVariants = cva(styles.icon, { variants: { diff --git a/apps/scandic-web/components/Maps/Markers/index.tsx b/apps/scandic-web/components/Maps/Markers/index.tsx index 01311b520..b8175709c 100644 --- a/apps/scandic-web/components/Maps/Markers/index.tsx +++ b/apps/scandic-web/components/Maps/Markers/index.tsx @@ -1,3 +1,5 @@ +import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" + import DowntownCamperMarker from "./DowntownCamper" import DowntownCamperSmallMarker from "./DowntownCamperSmall" import GrandHotelMarker from "./GrandHotel" @@ -15,8 +17,8 @@ import ScandicSmallMarker from "./ScandicSmall" import TheDockMarker from "./TheDock" import TheDockSmallMarker from "./TheDockSmall" -import type { MarkerInfo } from "@/types/components/maps/marker" -import { HotelTypeEnum } from "@/types/enums/hotelType" +import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker" + import { SignatureHotelEnum } from "@/types/enums/signatureHotel" interface HotelMarkerByTypeProps diff --git a/apps/scandic-web/components/Maps/Markers/utils.ts b/apps/scandic-web/components/Maps/Markers/utils.ts index 2aa3c31e2..74617e63e 100644 --- a/apps/scandic-web/components/Maps/Markers/utils.ts +++ b/apps/scandic-web/components/Maps/Markers/utils.ts @@ -1,6 +1,6 @@ -import { IconName } from "@/components/Icons/iconName" +import { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest" -import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest" +import { IconName } from "@/components/Icons/iconName" export function getIconByPoiGroupAndCategory( group: PointOfInterestGroupEnum, diff --git a/apps/scandic-web/components/MyPages/DigitalTeamMemberCard/Alert/index.tsx b/apps/scandic-web/components/MyPages/DigitalTeamMemberCard/Alert/index.tsx index 3b08b9677..54f5854dd 100644 --- a/apps/scandic-web/components/MyPages/DigitalTeamMemberCard/Alert/index.tsx +++ b/apps/scandic-web/components/MyPages/DigitalTeamMemberCard/Alert/index.tsx @@ -3,12 +3,12 @@ import { useRouter, useSearchParams } from "next/navigation" import { useIntl } from "react-intl" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { DTMC_SUCCESS_BANNER_KEY } from "@/constants/dtmc" import Alert from "@/components/TempDesignSystem/Alert" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function DigitalTeamMemberCardAlert() { const intl = useIntl() const router = useRouter() diff --git a/apps/scandic-web/components/MyPages/Profile/index.tsx b/apps/scandic-web/components/MyPages/Profile/index.tsx index 51f11d8df..019c911de 100644 --- a/apps/scandic-web/components/MyPages/Profile/index.tsx +++ b/apps/scandic-web/components/MyPages/Profile/index.tsx @@ -1,4 +1,5 @@ import { Lang } from "@scandic-hotels/common/constants/language" +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" @@ -15,7 +16,6 @@ import Header from "@/components/Profile/Header" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import { isValidCountry } from "@/utils/countries" -import { isValidLang } from "@/utils/languages" import ChangeNameDisclaimer from "./ChangeNameDisclaimer" diff --git a/apps/scandic-web/components/OpeningHours/AlternateOpeningHours/index.tsx b/apps/scandic-web/components/OpeningHours/AlternateOpeningHours/index.tsx index 0ead68d60..bd34c886f 100644 --- a/apps/scandic-web/components/OpeningHours/AlternateOpeningHours/index.tsx +++ b/apps/scandic-web/components/OpeningHours/AlternateOpeningHours/index.tsx @@ -9,7 +9,7 @@ import { getGroupedOpeningHours } from "../utils" import styles from "../openingHours.module.css" -import type { RestaurantOpeningHours } from "@/types/hotel" +import type { RestaurantOpeningHours } from "@scandic-hotels/trpc/types/hotel" interface AlternateOpeningHoursProps { alternateOpeningHours: RestaurantOpeningHours diff --git a/apps/scandic-web/components/OpeningHours/index.tsx b/apps/scandic-web/components/OpeningHours/index.tsx index b63aa93a9..74a9b9771 100644 --- a/apps/scandic-web/components/OpeningHours/index.tsx +++ b/apps/scandic-web/components/OpeningHours/index.tsx @@ -10,7 +10,7 @@ import { getGroupedOpeningHours } from "./utils" import styles from "./openingHours.module.css" -import type { RestaurantOpeningHours } from "@/types/hotel" +import type { RestaurantOpeningHours } from "@scandic-hotels/trpc/types/hotel" interface OpeningHoursProps { openingHours: RestaurantOpeningHours diff --git a/apps/scandic-web/components/OpeningHours/openingHours.test.ts b/apps/scandic-web/components/OpeningHours/openingHours.test.ts index ba37c468e..769072c3a 100644 --- a/apps/scandic-web/components/OpeningHours/openingHours.test.ts +++ b/apps/scandic-web/components/OpeningHours/openingHours.test.ts @@ -2,10 +2,9 @@ import { describe, expect, it } from "@jest/globals" import { getGroupedOpeningHours } from "./utils" +import type { RestaurantOpeningHours } from "@scandic-hotels/trpc/types/hotel" import type { IntlShape } from "react-intl" -import type { RestaurantOpeningHours } from "@/types/hotel" - // Mock IntlShape for testing const mockIntl = { formatMessage: ({ id }: { id: string }) => { diff --git a/apps/scandic-web/components/OpeningHours/utils.ts b/apps/scandic-web/components/OpeningHours/utils.ts index f8b1a6b41..746217474 100644 --- a/apps/scandic-web/components/OpeningHours/utils.ts +++ b/apps/scandic-web/components/OpeningHours/utils.ts @@ -1,7 +1,6 @@ +import type { RestaurantOpeningHours } from "@scandic-hotels/trpc/types/hotel" import type { IntlShape } from "react-intl" -import type { RestaurantOpeningHours } from "@/types/hotel" - export function getGroupedOpeningHours( openingHours: RestaurantOpeningHours, intl: IntlShape diff --git a/apps/scandic-web/components/ParkingInformation/index.tsx b/apps/scandic-web/components/ParkingInformation/index.tsx index c087284ed..ec618e985 100644 --- a/apps/scandic-web/components/ParkingInformation/index.tsx +++ b/apps/scandic-web/components/ParkingInformation/index.tsx @@ -13,7 +13,7 @@ import ParkingPrices from "./ParkingPrices" import styles from "./parkingInformation.module.css" -import type { Parking } from "@/types/hotel" +import type { Parking } from "@scandic-hotels/trpc/types/hotel" interface ParkingInformationProps { parking: Parking diff --git a/apps/scandic-web/components/Rewards/ExpirationDate/index.tsx b/apps/scandic-web/components/Rewards/ExpirationDate/index.tsx index 3eaa3b71d..0b2a8f984 100644 --- a/apps/scandic-web/components/Rewards/ExpirationDate/index.tsx +++ b/apps/scandic-web/components/Rewards/ExpirationDate/index.tsx @@ -2,10 +2,9 @@ import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import { Typography } from "@scandic-hotels/design-system/Typography" -import { dt } from "@/lib/dt" - import useLang from "@/hooks/useLang" import styles from "./expirationDate.module.css" diff --git a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Breakfast.tsx b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Breakfast.tsx index ca8513497..c5611f8b9 100644 --- a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Breakfast.tsx +++ b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/Accordions/Breakfast.tsx @@ -3,6 +3,7 @@ import { useIntl } from "react-intl" import { Typography } from "@scandic-hotels/design-system/Typography" +import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" import { isDefined } from "@/server/utils" @@ -13,7 +14,6 @@ import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem import styles from "./sidePeekAccordion.module.css" import type { BreakfastAccordionItemProps } from "@/types/components/sidePeeks/amenities" -import { HotelTypeEnum } from "@/types/enums/hotelType" export default function BreakfastAccordionItem({ restaurants, diff --git a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/AdditionalAmenities/index.tsx b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/AdditionalAmenities/index.tsx index dff96d538..b00ed515b 100644 --- a/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/AdditionalAmenities/index.tsx +++ b/apps/scandic-web/components/SidePeeks/AmenitiesSidepeekContent/AdditionalAmenities/index.tsx @@ -1,11 +1,11 @@ import { Typography } from "@scandic-hotels/design-system/Typography" +import { FacilityEnum } from "@scandic-hotels/trpc/enums/facilities" import { FacilityToIcon } from "../../../ContentType/HotelPage/data" import styles from "./additionalAmenities.module.css" import type { AdditionalAmenitiesProps } from "@/types/components/sidePeeks/amenities" -import { FacilityEnum } from "@/types/enums/facilities" export default function AdditionalAmenities({ amenities, diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index 3e980a481..a90747a48 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -1,11 +1,12 @@ import { useIntl } from "react-intl" +import { dt } from "@scandic-hotels/common/dt" import DiscountIcon from "@scandic-hotels/design-system/Icons/DiscountIcon" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { changeOrCancelDateFormat } from "@/constants/dateFormats" -import { dt } from "@/lib/dt" import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails" import PriceType from "@/components/HotelReservation/MyStay/PriceType" @@ -24,12 +25,12 @@ import RoomDetails from "./RoomDetails" import styles from "./bookedRoomSidePeek.module.css" +import type { Room as HotelRoom } from "@scandic-hotels/trpc/types/hotel" + 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 { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" -import type { Room as HotelRoom } from "@/types/hotel" import type { Packages } from "@/types/requests/packages" import type { BookingConfirmationSchema } from "@/types/trpc/routers/booking/confirmation" import type { SafeUser } from "@/types/user" diff --git a/apps/scandic-web/components/SidePeeks/RoomSidePeek/RoomSidePeekContent/index.tsx b/apps/scandic-web/components/SidePeeks/RoomSidePeek/RoomSidePeekContent/index.tsx index 076c9a1a7..580adb41c 100644 --- a/apps/scandic-web/components/SidePeeks/RoomSidePeek/RoomSidePeekContent/index.tsx +++ b/apps/scandic-web/components/SidePeeks/RoomSidePeek/RoomSidePeekContent/index.tsx @@ -11,7 +11,7 @@ import { FacilityIcon } from "../facilityIcon" import styles from "./roomSidePeekContent.module.css" -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" interface RoomSidePeekContentProps { room: Room diff --git a/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/ContactRow/index.tsx b/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/ContactRow/index.tsx index 6f432565e..8982d03b4 100644 --- a/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/ContactRow/index.tsx +++ b/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/ContactRow/index.tsx @@ -2,14 +2,15 @@ import { MaterialIcon, type MaterialIconSetIconProps, } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { getValueFromContactConfig } from "@scandic-hotels/trpc/utils/contactConfig" import { serverClient } from "@/lib/trpc/server" import Link from "@/components/TempDesignSystem/Link" import Body from "@/components/TempDesignSystem/Text/Body" import Footnote from "@/components/TempDesignSystem/Text/Footnote" -import { getValueFromContactConfig } from "@/utils/contactConfig" +// import { getValueFromContactConfig } from "@/utils/contactConfig" import styles from "./contactRow.module.css" import type { ContactRowProps } from "@/types/components/sidebar/joinLoyaltyContact" diff --git a/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/index.tsx b/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/index.tsx index a1759760f..06e61a9d6 100644 --- a/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/index.tsx +++ b/apps/scandic-web/components/Sidebar/JoinLoyalty/Contact/index.tsx @@ -1,3 +1,5 @@ +import { JoinLoyaltyContactEnums } from "@scandic-hotels/trpc/types/joinLoyaltyContact" + import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { getIntl } from "@/i18n" @@ -6,7 +8,6 @@ import ContactRow from "./ContactRow" import styles from "./contact.module.css" import type { ContactProps } from "@/types/components/sidebar/joinLoyaltyContact" -import { JoinLoyaltyContactEnums } from "@/types/enums/joinLoyaltyContact" export default async function Contact({ contactBlock }: ContactProps) { const intl = await getIntl() diff --git a/apps/scandic-web/components/Sidebar/index.tsx b/apps/scandic-web/components/Sidebar/index.tsx index 8010a547c..ca27ba6de 100644 --- a/apps/scandic-web/components/Sidebar/index.tsx +++ b/apps/scandic-web/components/Sidebar/index.tsx @@ -1,3 +1,6 @@ +import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent" +import { SidebarEnums } from "@scandic-hotels/trpc/types/sidebar" + import EmployeeBenefitsAuthCard from "@/components/DigitalTeamMemberCard/EmployeeBenefits/AuthCard" import JsonToHtml from "@/components/JsonToHtml" @@ -10,8 +13,6 @@ import MyPagesNavigation from "./MyPagesNavigation" import styles from "./sidebar.module.css" import type { SidebarProps } from "@/types/components/sidebar" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" -import { SidebarEnums } from "@/types/enums/sidebar" export default function Sidebar({ blocks }: SidebarProps) { return ( diff --git a/apps/scandic-web/components/SitewideAlert/index.tsx b/apps/scandic-web/components/SitewideAlert/index.tsx index 7df29cc8b..bd5a3e859 100644 --- a/apps/scandic-web/components/SitewideAlert/index.tsx +++ b/apps/scandic-web/components/SitewideAlert/index.tsx @@ -2,6 +2,8 @@ import { useCallback, useRef } from "react" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" + import { trpc } from "@/lib/trpc/client" import { StickyElementNameEnum } from "@/stores/sticky-position" @@ -12,8 +14,6 @@ import { debounce } from "@/utils/debounce" import styles from "./sitewideAlert.module.css" -import { AlertTypeEnum } from "@/types/enums/alert" - export default function SiteWideAlert() { const alertRef = useRef(null) const lang = useLang() diff --git a/apps/scandic-web/components/TempDesignSystem/Alert/Sidepeek/sidepeek.ts b/apps/scandic-web/components/TempDesignSystem/Alert/Sidepeek/sidepeek.ts index acd7ce35a..4a3747d91 100644 --- a/apps/scandic-web/components/TempDesignSystem/Alert/Sidepeek/sidepeek.ts +++ b/apps/scandic-web/components/TempDesignSystem/Alert/Sidepeek/sidepeek.ts @@ -1,4 +1,4 @@ -import type { SidepeekContent } from "@/types/trpc/routers/contentstack/siteConfig" +import type { SidepeekContent } from "@scandic-hotels/trpc/types/siteConfig" export interface AlertSidepeekProps { ctaText: string diff --git a/apps/scandic-web/components/TempDesignSystem/Alert/alert.ts b/apps/scandic-web/components/TempDesignSystem/Alert/alert.ts index 29953fce3..c04228b26 100644 --- a/apps/scandic-web/components/TempDesignSystem/Alert/alert.ts +++ b/apps/scandic-web/components/TempDesignSystem/Alert/alert.ts @@ -1,8 +1,8 @@ +import type { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" +import type { SidepeekContent } from "@scandic-hotels/trpc/types/siteConfig" import type { VariantProps } from "class-variance-authority" import type { AriaRole } from "react" -import type { AlertTypeEnum } from "@/types/enums/alert" -import type { SidepeekContent } from "@/types/trpc/routers/contentstack/siteConfig" import type { alertVariants } from "./variants" export interface AlertProps extends VariantProps { diff --git a/apps/scandic-web/components/TempDesignSystem/Alert/utils.tsx b/apps/scandic-web/components/TempDesignSystem/Alert/utils.tsx index 821ffaa31..76076287d 100644 --- a/apps/scandic-web/components/TempDesignSystem/Alert/utils.tsx +++ b/apps/scandic-web/components/TempDesignSystem/Alert/utils.tsx @@ -2,10 +2,10 @@ import { MaterialIcon, type MaterialIconSetIconProps, } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" import type { JSX } from "react" -import { AlertTypeEnum } from "@/types/enums/alert" import type { AlertProps } from "./alert" interface IconByAlertProps { diff --git a/apps/scandic-web/components/TempDesignSystem/Alert/variants.ts b/apps/scandic-web/components/TempDesignSystem/Alert/variants.ts index 020b886be..1726bd0c6 100644 --- a/apps/scandic-web/components/TempDesignSystem/Alert/variants.ts +++ b/apps/scandic-web/components/TempDesignSystem/Alert/variants.ts @@ -1,8 +1,8 @@ import { cva } from "class-variance-authority" -import styles from "./alert.module.css" +import { AlertTypeEnum } from "@scandic-hotels/trpc/types/alertType" -import { AlertTypeEnum } from "@/types/enums/alert" +import styles from "./alert.module.css" export const alertVariants = cva(styles.alert, { variants: { diff --git a/apps/scandic-web/components/TempDesignSystem/Card/card.ts b/apps/scandic-web/components/TempDesignSystem/Card/card.ts index 6c6f4e740..80fac2178 100644 --- a/apps/scandic-web/components/TempDesignSystem/Card/card.ts +++ b/apps/scandic-web/components/TempDesignSystem/Card/card.ts @@ -1,7 +1,7 @@ +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" import type { VariantProps } from "class-variance-authority" import type { ApiImage } from "@/types/components/image" -import type { ImageVaultAsset } from "@/types/components/imageVault" import type { cardVariants } from "./variants" export interface CardProps diff --git a/apps/scandic-web/components/TempDesignSystem/Form/Date/date.test.tsx b/apps/scandic-web/components/TempDesignSystem/Form/Date/date.test.tsx index 01ccb7c57..200869873 100644 --- a/apps/scandic-web/components/TempDesignSystem/Form/Date/date.test.tsx +++ b/apps/scandic-web/components/TempDesignSystem/Form/Date/date.test.tsx @@ -6,8 +6,7 @@ import { type UserEvent, userEvent } from "@testing-library/user-event" import { FormProvider, useForm } from "react-hook-form" import { Lang } from "@scandic-hotels/common/constants/language" - -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import { getLocalizedMonthName } from "@/utils/dateFormatting" diff --git a/apps/scandic-web/components/TempDesignSystem/Form/Date/index.tsx b/apps/scandic-web/components/TempDesignSystem/Form/Date/index.tsx index 21dbf6f1b..9363cf673 100644 --- a/apps/scandic-web/components/TempDesignSystem/Form/Date/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/Form/Date/index.tsx @@ -5,10 +5,9 @@ import { useController, useFormContext, useWatch } from "react-hook-form" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" +import { dt } from "@scandic-hotels/common/dt" import { Select } from "@scandic-hotels/design-system/Select" -import { dt } from "@/lib/dt" - import useLang from "@/hooks/useLang" import { getLocalizedMonthName } from "@/utils/dateFormatting" import { rangeArray } from "@/utils/rangeArray" diff --git a/apps/scandic-web/components/TempDesignSystem/Grids/Dynamic/dynamic.ts b/apps/scandic-web/components/TempDesignSystem/Grids/Dynamic/dynamic.ts index e7f6dfb2e..48c418452 100644 --- a/apps/scandic-web/components/TempDesignSystem/Grids/Dynamic/dynamic.ts +++ b/apps/scandic-web/components/TempDesignSystem/Grids/Dynamic/dynamic.ts @@ -1,4 +1,5 @@ -import type { Edges } from "@/types/requests/utils/edges" +import type { Edges } from "@scandic-hotels/trpc/types/edges" + import type { TypenameInterface } from "@/types/requests/utils/typename" export type Order = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 diff --git a/apps/scandic-web/components/TempDesignSystem/LoyaltyCard/loyaltyCard.ts b/apps/scandic-web/components/TempDesignSystem/LoyaltyCard/loyaltyCard.ts index e1aa2124f..0bf119438 100644 --- a/apps/scandic-web/components/TempDesignSystem/LoyaltyCard/loyaltyCard.ts +++ b/apps/scandic-web/components/TempDesignSystem/LoyaltyCard/loyaltyCard.ts @@ -1,6 +1,6 @@ +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" import type { VariantProps } from "class-variance-authority" -import type { ImageVaultAsset } from "@/types/components/imageVault" import type { loyaltyCardVariants } from "./variants" export interface LoyaltyCardProps diff --git a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx index b194430e5..3885a5712 100644 --- a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx @@ -1,3 +1,6 @@ +import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks" +import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent" + import Overview from "@/components/Blocks/DynamicContent/Overview" import EarnAndBurn from "@/components/Blocks/DynamicContent/Points/EarnAndBurn" import PointsOverview from "@/components/Blocks/DynamicContent/Points/Overview" @@ -12,8 +15,6 @@ import type { AccountPageContentProps, ContentProps, } from "@/types/components/myPages/myPage/accountPage" -import { BlocksEnums } from "@/types/enums/blocks" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" async function DynamicComponent({ dynamic_content }: AccountPageContentProps) { const lang = await getLang() diff --git a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx index 8bcfbab4c..2400cb3b8 100644 --- a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx @@ -1,3 +1,5 @@ +import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks" + import CardsGrid from "@/components/Blocks/CardsGrid" import DynamicContent from "@/components/Blocks/DynamicContent" import ShortcutsList from "@/components/Blocks/ShortcutsList" @@ -6,7 +8,7 @@ import { getLang } from "@/i18n/serverContext" import { modWebviewLink } from "@/utils/webviews" import type { BlocksProps } from "@/types/components/blocks" -import { BlocksEnums } from "@/types/enums/blocks" +// import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks" export default async function Blocks({ blocks }: BlocksProps) { const lang = await getLang() diff --git a/apps/scandic-web/constants/booking.ts b/apps/scandic-web/constants/booking.ts index aeb57f524..25f84901d 100644 --- a/apps/scandic-web/constants/booking.ts +++ b/apps/scandic-web/constants/booking.ts @@ -8,6 +8,7 @@ import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIc import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon" import BedWallExtraIcon from "@scandic-hotels/design-system/Icons/BedWallExtraIcon" +import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import type { IconProps } from "@scandic-hotels/design-system/Icons" import type { JSX } from "react" @@ -28,13 +29,6 @@ export enum BookingStatusEnum { PendingPayment = "PendingPayment", } -export enum ChildBedTypeEnum { - Crib = "Crib", - ExtraBed = "ExtraBed", - ParentsBed = "ParentsBed", - Unknown = "Unknown", -} - export const FamilyAndFriendsCodes = ["D000029555", "D000029271", "D000029195"] export const REDEMPTION = "redemption" @@ -43,28 +37,6 @@ export const SEARCHTYPE = "searchtype" export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError" -export enum PaymentMethodEnum { - card = "card", - swish = "swish", - vipps = "vipps", - mobilePay = "mobilePay", - applePay = "applePay", - googlePay = "googlePay", - alipayPlus = "alipayPlus", - weChatPay = "weChatPay", - payPal = "payPal", - klarna = "klarna", - americanExpress = "americanExpress", - dankort = "dankort", - dinersClub = "dinersClub", - jcb = "jcb", - masterCard = "masterCard", - visa = "visa", - maestro = "maestro", - chinaUnionPay = "chinaUnionPay", - discover = "discover", -} - export enum BookingErrorCodeEnum { InternalError = "InternalError", ReservationError = "ReservationError", diff --git a/apps/scandic-web/constants/membershipLevels.ts b/apps/scandic-web/constants/membershipLevels.ts index 7a00138e4..adfb788db 100644 --- a/apps/scandic-web/constants/membershipLevels.ts +++ b/apps/scandic-web/constants/membershipLevels.ts @@ -1,3 +1,5 @@ +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" + import type { EurobonusTier } from "@/types/user" export const FriendsMembershipLevels = [ @@ -20,16 +22,6 @@ export enum membershipLevels { L7 = 7, } -export enum MembershipLevelEnum { - L1 = "L1", - L2 = "L2", - L3 = "L3", - L4 = "L4", - L5 = "L5", - L6 = "L6", - L7 = "L7", -} - /** * @note Membership levels should always be in English. */ @@ -43,8 +35,6 @@ export const TIER_TO_FRIEND_MAP: Record = { [MembershipLevelEnum.L7]: "Best Friend", } -export type MembershipLevel = keyof typeof MembershipLevelEnum - export const SAS_EUROBONUS_TIER_TO_NAME_MAP: Record = { EBB: "Member", EBS: "Silver", diff --git a/apps/scandic-web/constants/missingPointsHrefs.ts b/apps/scandic-web/constants/missingPointsHrefs.ts index f07e94825..3ca73f530 100644 --- a/apps/scandic-web/constants/missingPointsHrefs.ts +++ b/apps/scandic-web/constants/missingPointsHrefs.ts @@ -1,4 +1,4 @@ -import type { LangRoute } from "@/types/routes" +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const missingPoints: LangRoute = { da: "https://www.scandichotels.dk/form/manglende-point", diff --git a/apps/scandic-web/constants/myBooking.ts b/apps/scandic-web/constants/myBooking.ts index 093a891e6..d0fa7187d 100644 --- a/apps/scandic-web/constants/myBooking.ts +++ b/apps/scandic-web/constants/myBooking.ts @@ -1,4 +1,4 @@ -import type { LangRoute } from "@/types/routes" +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const myBookingPath: LangRoute = { da: "/hotelreservation/min-booking", diff --git a/apps/scandic-web/constants/rewards.ts b/apps/scandic-web/constants/rewards.ts index 1959d9f27..d6543399f 100644 --- a/apps/scandic-web/constants/rewards.ts +++ b/apps/scandic-web/constants/rewards.ts @@ -1,41 +1 @@ -export const REWARD_IDS = { - // Food & Beverage - TenPercentFood: "tier_10_percent_food_tier", - TwoForOneBreakfast: "tier_2_for_one_breakfast", - FifteenPercentFood: "tier_15_percent_food", - FreeKidsDrink: "tier_free_kids_drink", - FreeBreakfast: "tier_free_breakfast", - - // Monetary Vouchers - Bonus50SEK: "tier_50_SEK_bonus_voucher", - Bonus75SEK: "tier_75_SEK_bonus_voucher", - Bonus100SEK: "tier_100_SEK_bonus_voucher", - Bonus150SEK: "tier_150_SEK_bonus_voucher", - Bonus200SEK: "tier_200_SEK_bonus_voucher", - - // Hotel Perks - EarlyCheckin: "tier_early_checkin_tier", - LateCheckout: "tier_late_checkout", - FreeUpgrade: "tier_free_upgrade", - RoomGuarantee48H: "tier_48_h_room_guarantee", - // GymAccess: "tier_gym_access", - - // Earning & Points - EarnRate25Percent: "tier_25_percent_earn_rate", - EarnRate50Percent: "tier_50_percent_earn_rate", - StayBoostForKids: "tier_stay_boost_for_kids", - MemberRate: "tier_member_rate", - - // Special - YearlyExclusiveGift: "tier_yearly_exclusive_gift", -} as const - -export const RESTAURANT_REWARD_IDS = [ - REWARD_IDS.TenPercentFood, - REWARD_IDS.TwoForOneBreakfast, - REWARD_IDS.FifteenPercentFood, - REWARD_IDS.FreeKidsDrink, - REWARD_IDS.FreeBreakfast, -] as const - export const REWARDS_PER_PAGE = 6 diff --git a/apps/scandic-web/constants/routes/baseUrls.ts b/apps/scandic-web/constants/routes/baseUrls.ts deleted file mode 100644 index e2ef4027e..000000000 --- a/apps/scandic-web/constants/routes/baseUrls.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" - -export const baseUrls: LanguageSwitcherData = { - da: { url: "/da/" }, - de: { url: "/de/" }, - en: { url: "/en/" }, - fi: { url: "/fi/" }, - no: { url: "/no/" }, - sv: { url: "/sv/" }, -} diff --git a/apps/scandic-web/constants/routes/dtmc.ts b/apps/scandic-web/constants/routes/dtmc.ts index 3106d67c2..562525737 100644 --- a/apps/scandic-web/constants/routes/dtmc.ts +++ b/apps/scandic-web/constants/routes/dtmc.ts @@ -1,4 +1,4 @@ -import type { LangRoute } from "@/types/routes" +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const employeeBenefits: LangRoute = { en: "/en/employee-benefits", diff --git a/apps/scandic-web/constants/routes/handleAuth.js b/apps/scandic-web/constants/routes/handleAuth.js index 0879d580f..507b481a5 100644 --- a/apps/scandic-web/constants/routes/handleAuth.js +++ b/apps/scandic-web/constants/routes/handleAuth.js @@ -2,7 +2,7 @@ * These are routes for login, logout, signup, etc. */ -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const login = { da: "/da/log-pa", de: "/de/anmeldung", @@ -12,7 +12,7 @@ export const login = { sv: "/sv/logga-in", } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const loginUnLocalized = { da: "/da/login", de: "/de/login", @@ -22,7 +22,7 @@ export const loginUnLocalized = { sv: "/sv/login", } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const logout = { da: "/da/log-ud", de: "/de/ausloggen", @@ -32,7 +32,7 @@ export const logout = { sv: "/sv/logga-ut", } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const logoutUnLocalized = { da: "/da/logout", de: "/de/logout", @@ -42,7 +42,7 @@ export const logoutUnLocalized = { sv: "/sv/logout", } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const verifymagiclink = { da: "/da/verifymagiclink", de: "/de/verifymagiclink", diff --git a/apps/scandic-web/constants/routes/myPages.js b/apps/scandic-web/constants/routes/myPages.js index 3e4a4e3a6..6f9296af4 100644 --- a/apps/scandic-web/constants/routes/myPages.js +++ b/apps/scandic-web/constants/routes/myPages.js @@ -7,7 +7,7 @@ * These are routes that define code entries for My pages */ -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const scandicFriends = { da: "/da/scandic-friends", de: "/de/scandic-friends", @@ -17,7 +17,7 @@ export const scandicFriends = { sv: "/sv/scandic-friends", } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const myPages = { da: `${scandicFriends.da}/mine-sider`, de: `${scandicFriends.de}/mein-bereich`, @@ -27,7 +27,7 @@ export const myPages = { sv: `${scandicFriends.sv}/mina-sidor`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const overview = { da: `${myPages.da}/oversigt`, de: `${myPages.de}/uberblick`, @@ -38,7 +38,7 @@ export const overview = { } /** TODO: Update to relevant paths */ -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const profile = { da: `${myPages.da}/profil`, de: `${myPages.de}/profil`, @@ -48,7 +48,7 @@ export const profile = { sv: `${myPages.sv}/profil`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const profileEdit = { da: `${profile.da}/rediger`, de: `${profile.de}/bearbeiten`, @@ -58,7 +58,7 @@ export const profileEdit = { sv: `${profile.sv}/redigera`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const points = { da: `${myPages.da}/point`, de: `${myPages.de}/punkte`, @@ -68,7 +68,7 @@ export const points = { sv: `${myPages.sv}/poang`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const benefits = { da: `${myPages.da}/fordele`, de: `${myPages.de}/vorteile`, @@ -78,7 +78,7 @@ export const benefits = { sv: `${myPages.sv}/formaner`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const stays = { da: `${myPages.da}/ophold`, de: `${myPages.de}/aufenthalte`, @@ -88,7 +88,7 @@ export const stays = { sv: `${myPages.sv}/vistelser`, } -/** @type {import('@/types/routes').LangRoute} */ +/** @type {import('@scandic-hotels/common/constants/routes/langRoute').LangRoute} */ export const partnerSas = { da: `${myPages.da}/sas-eurobonus`, de: `${myPages.de}/sas-eurobonus`, diff --git a/apps/scandic-web/constants/routes/signup.ts b/apps/scandic-web/constants/routes/signup.ts index df6bf03d8..b487d321f 100644 --- a/apps/scandic-web/constants/routes/signup.ts +++ b/apps/scandic-web/constants/routes/signup.ts @@ -1,4 +1,4 @@ -import type { LangRoute } from "@/types/routes" +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const signup: LangRoute = { en: "/en/scandic-friends/join", diff --git a/apps/scandic-web/constants/webHrefs.ts b/apps/scandic-web/constants/webHrefs.ts index 407a8b227..2772378da 100644 --- a/apps/scandic-web/constants/webHrefs.ts +++ b/apps/scandic-web/constants/webHrefs.ts @@ -1,6 +1,6 @@ import { Lang } from "@scandic-hotels/common/constants/language" -import type { LangRoute } from "@/types/routes" +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" export const bookingTermsAndConditions: LangRoute = { da: `/${Lang.da}/kundeservice/priser-og-bookingvilkar/vilkar-og-betingelser3`, diff --git a/apps/scandic-web/global.d.ts b/apps/scandic-web/global.d.ts index f50285b05..edf0a58b3 100644 --- a/apps/scandic-web/global.d.ts +++ b/apps/scandic-web/global.d.ts @@ -1 +1,2 @@ import "@scandic-hotels/common/global.d.ts" +import "@scandic-hotels/trpc/types.d.ts" diff --git a/apps/scandic-web/hooks/booking/useAvailablePaymentOptions.ts b/apps/scandic-web/hooks/booking/useAvailablePaymentOptions.ts index 38ad26c7b..607aec8e1 100644 --- a/apps/scandic-web/hooks/booking/useAvailablePaymentOptions.ts +++ b/apps/scandic-web/hooks/booking/useAvailablePaymentOptions.ts @@ -2,7 +2,7 @@ import { useEffect, useState } from "react" -import { PaymentMethodEnum } from "@/constants/booking" +import { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" export function useAvailablePaymentOptions( otherPaymentOptions: PaymentMethodEnum[] diff --git a/apps/scandic-web/hooks/useLang.ts b/apps/scandic-web/hooks/useLang.ts index 8b795c103..8731c4fcc 100644 --- a/apps/scandic-web/hooks/useLang.ts +++ b/apps/scandic-web/hooks/useLang.ts @@ -2,8 +2,7 @@ import { useParams } from "next/navigation" import { Lang } from "@scandic-hotels/common/constants/language" - -import { languageSchema } from "@/utils/languages" +import { languageSchema } from "@scandic-hotels/common/utils/languages" import type { LangParams } from "@/types/params" diff --git a/apps/scandic-web/i18n/serverContext.ts b/apps/scandic-web/i18n/serverContext.ts index d8ed5b06a..1b569e6bb 100644 --- a/apps/scandic-web/i18n/serverContext.ts +++ b/apps/scandic-web/i18n/serverContext.ts @@ -5,7 +5,7 @@ import { cache } from "react" import { Lang } from "@scandic-hotels/common/constants/language" -import { languageSchema } from "@/utils/languages" +import { languageSchema } from "@scandic-hotels/common/utils/languages" const getRef = cache(() => ({ current: undefined as Lang | undefined })) diff --git a/apps/scandic-web/lib/trpc/memoizedRequests/index.ts b/apps/scandic-web/lib/trpc/memoizedRequests/index.ts index 484f12593..1c02bdf25 100644 --- a/apps/scandic-web/lib/trpc/memoizedRequests/index.ts +++ b/apps/scandic-web/lib/trpc/memoizedRequests/index.ts @@ -8,19 +8,19 @@ import { cache } from "@/utils/cache" import { serverClient } from "../server" import type { Lang } from "@scandic-hotels/common/constants/language" +import type { GetHotelsByCSFilterInput } from "@scandic-hotels/trpc/routers/hotels/input" +import type { Country } from "@scandic-hotels/trpc/types/country" +import type { + CityCoordinatesInput, + HotelInput, +} from "@scandic-hotels/trpc/types/hotel" -import type { Country } from "@/types/enums/country" import type { AncillaryPackagesInput, BreackfastPackagesInput, PackagesInput, } from "@/types/requests/packages" import type { RoomsAvailabilityExtendedInputSchema } from "@/types/trpc/routers/hotel/availability" -import type { - CityCoordinatesInput, - HotelInput, -} from "@/types/trpc/routers/hotel/hotel" -import type { GetHotelsByCSFilterInput } from "@/server/routers/hotels/input" import type { GetSavedPaymentCardsInput } from "@/server/routers/user/input" export const getLocations = cache(async function getMemoizedLocations() { diff --git a/apps/scandic-web/middleware.ts b/apps/scandic-web/middleware.ts index 9c066784f..15b0aa191 100644 --- a/apps/scandic-web/middleware.ts +++ b/apps/scandic-web/middleware.ts @@ -2,6 +2,7 @@ import * as Sentry from "@sentry/nextjs" import { type NextMiddleware, NextResponse } from "next/server" import { Lang } from "@scandic-hotels/common/constants/language" +import { findLang } from "@scandic-hotels/common/utils/languages" import * as authRequired from "@/middlewares/authRequired" import * as bookingFlow from "@/middlewares/bookingFlow" @@ -21,7 +22,6 @@ import * as sasXScandic from "@/middlewares/sasXScandic" import * as trailingSlash from "@/middlewares/trailingSlash" import { getDefaultRequestHeaders } from "@/middlewares/utils" import * as webView from "@/middlewares/webView" -import { findLang } from "@/utils/languages" export const middleware: NextMiddleware = async (request, event) => { // auth() overrides the request origin, we need the original for internal rewrites diff --git a/apps/scandic-web/middlewares/authRequired.ts b/apps/scandic-web/middlewares/authRequired.ts index ce8997a82..f2da4a5ea 100644 --- a/apps/scandic-web/middlewares/authRequired.ts +++ b/apps/scandic-web/middlewares/authRequired.ts @@ -1,11 +1,12 @@ import { type NextMiddleware, NextResponse } from "next/server" +import { findLang } from "@scandic-hotels/common/utils/languages" + import { authRequired, mfaRequired } from "@/constants/routes/authRequired" import { login } from "@/constants/routes/handleAuth" import { getInternalNextURL, getPublicNextURL } from "@/server/utils" import { auth } from "@/auth" -import { findLang } from "@/utils/languages" import type { MiddlewareMatcher } from "@/types/middleware" diff --git a/apps/scandic-web/middlewares/bookingFlow.ts b/apps/scandic-web/middlewares/bookingFlow.ts index 5f0e10788..fb44a2ec9 100644 --- a/apps/scandic-web/middlewares/bookingFlow.ts +++ b/apps/scandic-web/middlewares/bookingFlow.ts @@ -5,7 +5,7 @@ import { login } from "@/constants/routes/handleAuth" import { getPublicNextURL } from "@/server/utils" import { auth } from "@/auth" -import { findLang } from "@/utils/languages" +import { findLang } from "@scandic-hotels/common/utils/languages" import { isValidSession } from "@/utils/session" import { getDefaultRequestHeaders } from "./utils" diff --git a/apps/scandic-web/middlewares/cmsContent.ts b/apps/scandic-web/middlewares/cmsContent.ts index 4dcb4cf45..c77651a7a 100644 --- a/apps/scandic-web/middlewares/cmsContent.ts +++ b/apps/scandic-web/middlewares/cmsContent.ts @@ -1,13 +1,15 @@ import { type NextMiddleware, NextResponse } from "next/server" -import { getUidAndContentTypeByPath } from "@/services/cms/getUidAndContentTypeByPath" -import { findLang } from "@/utils/languages" -import { removeTrailingSlash } from "@/utils/url" +import { findLang } from "@scandic-hotels/common/utils/languages" +import { removeTrailingSlash } from "@scandic-hotels/common/utils/url" +import { getUidAndContentTypeByPath } from "@scandic-hotels/trpc/cms/getUidAndContentTypeByPath" +import { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType" + +import { internalServerError } from "@/server/errors/next" import { getDefaultRequestHeaders } from "./utils" import type { MiddlewareMatcher } from "@/types/middleware" -import { PageContentTypeEnum } from "@/types/requests/contentType" export const middleware: NextMiddleware = async (request) => { const { nextUrl } = request @@ -21,7 +23,11 @@ export const middleware: NextMiddleware = async (request) => { ? pathWithoutTrailingSlash.replace("/preview", "") : pathWithoutTrailingSlash - let { contentType, uid } = await getUidAndContentTypeByPath(incomingPathName) + let { contentType, uid, error } = + await getUidAndContentTypeByPath(incomingPathName) + if (error) { + throw internalServerError(error) + } const searchParams = new URLSearchParams(request.nextUrl.searchParams) diff --git a/apps/scandic-web/middlewares/currentWebLogin.ts b/apps/scandic-web/middlewares/currentWebLogin.ts index a9fb98002..d93fa944e 100644 --- a/apps/scandic-web/middlewares/currentWebLogin.ts +++ b/apps/scandic-web/middlewares/currentWebLogin.ts @@ -2,7 +2,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { badRequest } from "@/server/errors/next" -import { findLang } from "@/utils/languages" +import { findLang } from "@scandic-hotels/common/utils/languages" import type { MiddlewareMatcher } from "@/types/middleware" diff --git a/apps/scandic-web/middlewares/currentWebLoginEmail.ts b/apps/scandic-web/middlewares/currentWebLoginEmail.ts index 4aff277cb..2e496a7c7 100644 --- a/apps/scandic-web/middlewares/currentWebLoginEmail.ts +++ b/apps/scandic-web/middlewares/currentWebLoginEmail.ts @@ -2,7 +2,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { badRequest } from "@/server/errors/next" -import { findLang } from "@/utils/languages" +import { findLang } from "@scandic-hotels/common/utils/languages" import type { MiddlewareMatcher } from "@/types/middleware" diff --git a/apps/scandic-web/middlewares/currentWebLogout.ts b/apps/scandic-web/middlewares/currentWebLogout.ts index a60b04ada..57a8aea8b 100644 --- a/apps/scandic-web/middlewares/currentWebLogout.ts +++ b/apps/scandic-web/middlewares/currentWebLogout.ts @@ -3,7 +3,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { badRequest } from "@/server/errors/next" import { getPublicURL } from "@/server/utils" -import { findLang } from "@/utils/languages" +import { findLang } from "@scandic-hotels/common/utils/languages" import type { MiddlewareMatcher } from "@/types/middleware" diff --git a/apps/scandic-web/middlewares/familyAndFriends.ts b/apps/scandic-web/middlewares/familyAndFriends.ts index 58506ee5f..45d2fa953 100644 --- a/apps/scandic-web/middlewares/familyAndFriends.ts +++ b/apps/scandic-web/middlewares/familyAndFriends.ts @@ -2,7 +2,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { getPublicNextURL } from "@/server/utils" -import { findLang } from "@/utils/languages" +import { findLang } from "@scandic-hotels/common/utils/languages" import { getDefaultRequestHeaders } from "./utils" diff --git a/apps/scandic-web/middlewares/myPages.ts b/apps/scandic-web/middlewares/myPages.ts index 9d290d0b3..52e6a4ebf 100644 --- a/apps/scandic-web/middlewares/myPages.ts +++ b/apps/scandic-web/middlewares/myPages.ts @@ -1,17 +1,17 @@ import { type NextMiddleware, NextResponse } from "next/server" +import { findLang } from "@scandic-hotels/common/utils/languages" +import { resolve as resolveEntry } from "@scandic-hotels/trpc/utils/entry" + import { myPages, overview, profile, profileEdit, } from "@/constants/routes/myPages" -import { notFound } from "@/server/errors/next" +import { internalServerError, notFound } from "@/server/errors/next" import { getPublicNextURL } from "@/server/utils" -import { resolve as resolveEntry } from "@/utils/entry" -import { findLang } from "@/utils/languages" - import { getDefaultRequestHeaders } from "./utils" import type { MiddlewareMatcher } from "@/types/middleware" @@ -32,7 +32,13 @@ export const middleware: NextMiddleware = async (request) => { } const pathNameWithoutLang = nextUrl.pathname.replace(`/${lang}`, "") - const { uid, contentType } = await resolveEntry(pathNameWithoutLang, lang) + const { uid, contentType, error } = await resolveEntry( + pathNameWithoutLang, + lang + ) + if (error) { + throw internalServerError(error) + } if (!uid || !contentType) { throw notFound( `Unable to resolve CMS entry for locale "${lang}": ${pathNameWithoutLang}` diff --git a/apps/scandic-web/middlewares/redirect.ts b/apps/scandic-web/middlewares/redirect.ts index 627be94ec..a3d3b756e 100644 --- a/apps/scandic-web/middlewares/redirect.ts +++ b/apps/scandic-web/middlewares/redirect.ts @@ -1,12 +1,11 @@ import { type NextMiddleware, NextResponse } from "next/server" import { getCacheClient } from "@scandic-hotels/common/dataCache" +import { findLang } from "@scandic-hotels/common/utils/languages" import { notFound } from "@/server/errors/next" import { getPublicNextURL } from "@/server/utils" -import { findLang } from "@/utils/languages" - import { getDefaultRequestHeaders } from "./utils" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/middlewares/utils.ts b/apps/scandic-web/middlewares/utils.ts index 676642731..5f48598f7 100644 --- a/apps/scandic-web/middlewares/utils.ts +++ b/apps/scandic-web/middlewares/utils.ts @@ -1,7 +1,7 @@ -import { getPublicNextURL } from "@/server/utils" +import { findLang } from "@scandic-hotels/common/utils/languages" +import { removeTrailingSlash } from "@scandic-hotels/common/utils/url" -import { findLang } from "@/utils/languages" -import { removeTrailingSlash } from "@/utils/url" +import { getPublicNextURL } from "@/server/utils" import type { NextRequest } from "next/server" diff --git a/apps/scandic-web/middlewares/webView.ts b/apps/scandic-web/middlewares/webView.ts index 759b33498..346687821 100644 --- a/apps/scandic-web/middlewares/webView.ts +++ b/apps/scandic-web/middlewares/webView.ts @@ -1,5 +1,8 @@ import { type NextMiddleware, NextResponse } from "next/server" +import { findLang } from "@scandic-hotels/common/utils/languages" +import { resolve as resolveEntry } from "@scandic-hotels/trpc/utils/entry" + import { loyaltyPagesWebviews, myPagesWebviews, @@ -8,11 +11,9 @@ import { webviews, } from "@/constants/routes/webviews" import { env } from "@/env/server" -import { badRequest, notFound } from "@/server/errors/next" +import { badRequest, internalServerError, notFound } from "@/server/errors/next" import { decryptData } from "@/utils/aes" -import { resolve as resolveEntry } from "@/utils/entry" -import { findLang } from "@/utils/languages" import { getDefaultRequestHeaders } from "./utils" @@ -148,7 +149,11 @@ async function handleWebviewRewrite({ const pathNameWithoutLang = path.replace(`/${lang}/webview`, "") - const { uid } = await resolveEntry(pathNameWithoutLang, lang) + const { uid, error } = await resolveEntry(pathNameWithoutLang, lang) + if (error) { + throw internalServerError(error) + } + if (uid) { headers.set("x-uid", uid) } diff --git a/apps/scandic-web/next.config.ts b/apps/scandic-web/next.config.ts index 29f428e3c..3fba604c5 100644 --- a/apps/scandic-web/next.config.ts +++ b/apps/scandic-web/next.config.ts @@ -3,10 +3,14 @@ import { fileURLToPath } from "node:url" import * as Sentry from "@sentry/nextjs" import createJiti from "jiti" -import { findMyBooking } from "./constants/routes/findMyBooking.js" +import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { + myStay, + preliminaryReceipt, +} from "@scandic-hotels/common/constants/routes/myStay" + import { login, logout } from "./constants/routes/handleAuth.js" import { myPages } from "./constants/routes/myPages.js" -import { myStay, preliminaryReceipt } from "./constants/routes/myStay.js" import { myStay as myStayWebview, preliminaryReceipt as preliminaryReceiptWebview, diff --git a/apps/scandic-web/providers/BookingConfirmationProvider.tsx b/apps/scandic-web/providers/BookingConfirmationProvider.tsx index 88928beb7..48cb801cf 100644 --- a/apps/scandic-web/providers/BookingConfirmationProvider.tsx +++ b/apps/scandic-web/providers/BookingConfirmationProvider.tsx @@ -9,7 +9,7 @@ import { BookingConfirmationContext } from "@/contexts/BookingConfirmation" import { formatPrice } from "@/utils/numberFormatting" import type { BookingConfirmationStore } from "@/types/contexts/booking-confirmation" -import { CurrencyEnum } from "@/types/enums/currency" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import type { BookingConfirmationProviderProps } from "@/types/providers/booking-confirmation" export default function BookingConfirmationProvider({ diff --git a/apps/scandic-web/providers/EnterDetailsProvider.tsx b/apps/scandic-web/providers/EnterDetailsProvider.tsx index ed6eb4130..8998e2039 100644 --- a/apps/scandic-web/providers/EnterDetailsProvider.tsx +++ b/apps/scandic-web/providers/EnterDetailsProvider.tsx @@ -2,7 +2,8 @@ import deepmerge from "deepmerge" import { useEffect, useRef, useState } from "react" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" + import { createDetailsStore } from "@/stores/enter-details" import { checkIsSameBooking as checkIsSameBooking, diff --git a/apps/scandic-web/providers/MyStay.tsx b/apps/scandic-web/providers/MyStay.tsx index edecb80dd..81b86f187 100644 --- a/apps/scandic-web/providers/MyStay.tsx +++ b/apps/scandic-web/providers/MyStay.tsx @@ -13,7 +13,7 @@ import type { Lang } from "@scandic-hotels/common/constants/language" import type { Packages } from "@/types/components/myPages/myStay/ancillaries" import type { MyStayStore } from "@/types/contexts/my-stay" -import type { RoomCategories } from "@/types/hotel" +import type { RoomCategories } from "@scandic-hotels/trpc/types/hotel" import type { BookingConfirmation, BookingConfirmationSchema, diff --git a/apps/scandic-web/providers/SelectRate/RoomProvider.tsx b/apps/scandic-web/providers/SelectRate/RoomProvider.tsx index f4194630b..72a63c997 100644 --- a/apps/scandic-web/providers/SelectRate/RoomProvider.tsx +++ b/apps/scandic-web/providers/SelectRate/RoomProvider.tsx @@ -1,12 +1,13 @@ "use client" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" +import { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs" + import { useRatesStore } from "@/stores/select-rate" import { RoomContext } from "@/contexts/SelectRate/Room" -import { sortRoomConfigs } from "@/utils/sort" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { RoomProviderProps } from "@/types/providers/select-rate/room" export default function RoomProvider({ diff --git a/apps/scandic-web/server/index.ts b/apps/scandic-web/server/index.ts index 09c2d2a69..5a3276256 100644 --- a/apps/scandic-web/server/index.ts +++ b/apps/scandic-web/server/index.ts @@ -1,9 +1,9 @@ /** Routers */ import { router } from "@scandic-hotels/trpc" +import { contentstackRouter } from "@scandic-hotels/trpc/routers/contentstack" import { autocompleteRouter } from "./routers/autocomplete" import { bookingRouter } from "./routers/booking" -import { contentstackRouter } from "./routers/contentstack" import { hotelsRouter } from "./routers/hotels" import { navigationRouter } from "./routers/navigation" import { partnerRouter } from "./routers/partners" diff --git a/apps/scandic-web/server/routers/autocomplete/destinations.ts b/apps/scandic-web/server/routers/autocomplete/destinations.ts index 77e0cdf72..79af27a25 100644 --- a/apps/scandic-web/server/routers/autocomplete/destinations.ts +++ b/apps/scandic-web/server/routers/autocomplete/destinations.ts @@ -4,17 +4,21 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { getCacheClient } from "@scandic-hotels/common/dataCache" import { safeTry } from "@scandic-hotels/common/utils/safeTry" import { safeProtectedServiceProcedure } from "@scandic-hotels/trpc/procedures" +import { getCityPageUrls } from "@scandic-hotels/trpc/routers/contentstack/destinationCityPage/utils" +import { getCountryPageUrls } from "@scandic-hotels/trpc/routers/contentstack/destinationCountryPage/utils" +import { getHotelPageUrls } from "@scandic-hotels/trpc/routers/contentstack/hotelPage/utils" +import { + getCitiesByCountry, + getCountries, + getLocations, +} from "@scandic-hotels/trpc/routers/hotels/utils" +import { ApiCountry, type Country } from "@scandic-hotels/trpc/types/country" import { isDefined } from "@/server/utils" -import { getCityPageUrls } from "../contentstack/destinationCityPage/utils" -import { getCountryPageUrls } from "../contentstack/destinationCountryPage/utils" -import { getHotelPageUrls } from "../contentstack/hotelPage/utils" -import { getCitiesByCountry, getCountries, getLocations } from "../hotels/utils" import { filterAndCategorizeAutoComplete } from "./util/filterAndCategorizeAutoComplete" import { mapLocationToAutoCompleteLocation } from "./util/mapLocationToAutoCompleteLocation" -import { ApiCountry, type Country } from "@/types/enums/country" import type { AutoCompleteLocation } from "./schema" const destinationsAutoCompleteInputSchema = z.object({ diff --git a/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.test.ts b/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.test.ts index d9c0432e7..8ea6b7ff8 100644 --- a/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.test.ts +++ b/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.test.ts @@ -2,8 +2,9 @@ import { describe, expect, it } from "@jest/globals" import { getSearchTokens } from "./getSearchTokens" +import type { Location } from "@scandic-hotels/trpc/types/locations" + import type { DeepPartial } from "@/types/DeepPartial" -import type { Location } from "@/types/trpc/routers/hotel/locations" describe("getSearchTokens", () => { it("should return lowercased tokens for a hotel location", () => { diff --git a/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.ts b/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.ts index 426b731b5..31b603a51 100644 --- a/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.ts +++ b/apps/scandic-web/server/routers/autocomplete/util/getSearchTokens.ts @@ -1,6 +1,6 @@ import { normalizeAumlauts } from "./normalizeAumlauts" -import type { Location } from "@/types/trpc/routers/hotel/locations" +import type { Location } from "@scandic-hotels/trpc/types/locations" export function getSearchTokens(location: Location) { const tokens = [ diff --git a/apps/scandic-web/server/routers/autocomplete/util/mapLocationToAutoCompleteLocation.ts b/apps/scandic-web/server/routers/autocomplete/util/mapLocationToAutoCompleteLocation.ts index d2d7fa330..f75bfeb24 100644 --- a/apps/scandic-web/server/routers/autocomplete/util/mapLocationToAutoCompleteLocation.ts +++ b/apps/scandic-web/server/routers/autocomplete/util/mapLocationToAutoCompleteLocation.ts @@ -1,6 +1,7 @@ import { getSearchTokens } from "./getSearchTokens" -import type { Location } from "@/types/trpc/routers/hotel/locations" +import type { Location } from "@scandic-hotels/trpc/types/locations" + import type { AutoCompleteLocation } from "../schema" export function mapLocationToAutoCompleteLocation( diff --git a/apps/scandic-web/server/routers/booking/input.ts b/apps/scandic-web/server/routers/booking/input.ts index ace64abf6..52218c45f 100644 --- a/apps/scandic-web/server/routers/booking/input.ts +++ b/apps/scandic-web/server/routers/booking/input.ts @@ -1,8 +1,8 @@ import { z } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" +import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" -import { ChildBedTypeEnum } from "@/constants/booking" import { langToApiLang } from "@/constants/languages" const roomsSchema = z diff --git a/apps/scandic-web/server/routers/booking/mutation.ts b/apps/scandic-web/server/routers/booking/mutation.ts index 3bb78738e..1150d32e6 100644 --- a/apps/scandic-web/server/routers/booking/mutation.ts +++ b/apps/scandic-web/server/routers/booking/mutation.ts @@ -1,8 +1,8 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" +import * as api from "@scandic-hotels/trpc/api" import { safeProtectedServiceProcedure } from "@scandic-hotels/trpc/procedures" -import * as api from "@/lib/api" import { createRefIdPlugin } from "@/server/plugins/refIdToConfirmationNumber" import { getMembershipNumber } from "@/server/routers/user/utils" diff --git a/apps/scandic-web/server/routers/booking/output.ts b/apps/scandic-web/server/routers/booking/output.ts index dedcbd9a6..d75b117de 100644 --- a/apps/scandic-web/server/routers/booking/output.ts +++ b/apps/scandic-web/server/routers/booking/output.ts @@ -1,17 +1,18 @@ import { z } from "zod" -import { BookingStatusEnum, ChildBedTypeEnum } from "@/constants/booking" -import { dt } from "@/lib/dt" - -import { calculateRefId } from "@/utils/refId" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { dt } from "@scandic-hotels/common/dt" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" import { nullableStringEmailValidator, nullableStringValidator, -} from "@/utils/zod/stringValidator" +} from "@scandic-hotels/common/utils/zod/stringValidator" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { CurrencyEnum } from "@/types/enums/currency" +import { BookingStatusEnum } from "@/constants/booking" + +import { calculateRefId } from "@/utils/refId" const guestSchema = z.object({ email: nullableStringEmailValidator, diff --git a/apps/scandic-web/server/routers/booking/query.ts b/apps/scandic-web/server/routers/booking/query.ts index 22a4af777..68a6c8351 100644 --- a/apps/scandic-web/server/routers/booking/query.ts +++ b/apps/scandic-web/server/routers/booking/query.ts @@ -1,5 +1,6 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" +import * as api from "@scandic-hotels/trpc/api" import { badRequestError, serverErrorByStatus, @@ -8,15 +9,14 @@ import { safeProtectedServiceProcedure, serviceProcedure, } from "@scandic-hotels/trpc/procedures" +import { getHotel } from "@scandic-hotels/trpc/routers/hotels/utils" +import { toApiLang } from "@scandic-hotels/trpc/utils" -import * as api from "@/lib/api" import { createRefIdPlugin } from "@/server/plugins/refIdToConfirmationNumber" -import { toApiLang } from "@/server/utils" import { getBookedHotelRoom } from "@/utils/booking" import { encrypt } from "../../../utils/encryption" -import { getHotel } from "../hotels/utils" import { createRefIdInput, findBookingInput, diff --git a/apps/scandic-web/server/routers/booking/utils.ts b/apps/scandic-web/server/routers/booking/utils.ts index d0ad56284..82076cebd 100644 --- a/apps/scandic-web/server/routers/booking/utils.ts +++ b/apps/scandic-web/server/routers/booking/utils.ts @@ -1,11 +1,10 @@ import { createCounter } from "@scandic-hotels/common/telemetry" +import * as api from "@scandic-hotels/trpc/api" import { badRequestError, serverErrorByStatus, } from "@scandic-hotels/trpc/errors" - -import * as api from "@/lib/api" -import { toApiLang } from "@/server/utils" +import { toApiLang } from "@scandic-hotels/trpc/utils" import { bookingConfirmationSchema, createBookingSchema } from "./output" diff --git a/apps/scandic-web/server/routers/hotels/query.ts b/apps/scandic-web/server/routers/hotels/query.ts index ce14c8dae..f40af9a56 100644 --- a/apps/scandic-web/server/routers/hotels/query.ts +++ b/apps/scandic-web/server/routers/hotels/query.ts @@ -1,7 +1,13 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { getCacheClient } from "@scandic-hotels/common/dataCache" +import { dt } from "@scandic-hotels/common/dt" import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" +import * as api from "@scandic-hotels/trpc/api" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { RateEnum } from "@scandic-hotels/trpc/enums/rate" +import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { badRequestError, unauthorizedError } from "@scandic-hotels/trpc/errors" import { contentStackBaseWithServiceProcedure, @@ -9,18 +15,8 @@ import { safeProtectedServiceProcedure, serviceProcedure, } from "@scandic-hotels/trpc/procedures" - -import { REDEMPTION } from "@/constants/booking" -import { env } from "@/env/server" -import * as api from "@/lib/api" -import { dt } from "@/lib/dt" -import { getCityPageUrls } from "@/server/routers/contentstack/destinationCityPage/utils" -import { getVerifiedUser } from "@/server/routers/user/utils" -import { toApiLang } from "@/server/utils" - -import { getHotelPageUrls } from "../contentstack/hotelPage/utils" -import { additionalDataSchema } from "./schemas/hotel/include/additionalData" -import { meetingRoomsSchema } from "./schemas/meetingRoom" +import { getCityPageUrls } from "@scandic-hotels/trpc/routers/contentstack/destinationCityPage/utils" +import { getHotelPageUrls } from "@scandic-hotels/trpc/routers/contentstack/hotelPage/utils" import { ancillaryPackageInputSchema, breakfastPackageInputSchema, @@ -42,24 +38,34 @@ import { roomPackagesInputSchema, selectRateRoomAvailabilityInputSchema, selectRateRoomsAvailabilityInputSchema, -} from "./input" +} from "@scandic-hotels/trpc/routers/hotels/input" import { ancillaryPackagesSchema, breakfastPackagesSchema, getNearbyHotelIdsSchema, -} from "./output" +} from "@scandic-hotels/trpc/routers/hotels/output" +import { additionalDataSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/hotel/include/additionalData" import { - getBedTypes, getCitiesByCountry, getCountries, getHotel, getHotelIdsByCityId, getHotelIdsByCityIdentifier, getHotelIdsByCountry, - getHotelsAvailabilityByCity, - getHotelsAvailabilityByHotelIds, getHotelsByHotelIds, getLocations, +} from "@scandic-hotels/trpc/routers/hotels/utils" +import { toApiLang } from "@scandic-hotels/trpc/utils" + +import { REDEMPTION } from "@/constants/booking" +import { env } from "@/env/server" +import { getVerifiedUser } from "@/server/routers/user/utils" + +import { meetingRoomsSchema } from "./schemas/meetingRoom" +import { + getBedTypes, + getHotelsAvailabilityByCity, + getHotelsAvailabilityByHotelIds, getPackages, getRoomsAvailability, getSelectedRoomAvailability, @@ -67,13 +73,13 @@ import { selectRateRedirectURL, } from "./utils" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { RateEnum } from "@/types/enums/rate" -import { RateTypeEnum } from "@/types/enums/rateType" -import type { DestinationPagesHotelData, HotelDataWithUrl } from "@/types/hotel" +import type { + DestinationPagesHotelData, + HotelDataWithUrl, +} from "@scandic-hotels/trpc/types/hotel" +import type { CityLocation } from "@scandic-hotels/trpc/types/locations" + import type { Room } from "@/types/providers/details/room" -import type { CityLocation } from "@/types/trpc/routers/hotel/locations" export const hotelQueryRouter = router({ availability: router({ diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/poi.ts b/apps/scandic-web/server/routers/hotels/schemas/hotel/poi.ts deleted file mode 100644 index 85b6971d3..000000000 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/poi.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { z } from "zod" - -import { nullableNumberValidator } from "@/utils/zod/numberValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" - -import { getPoiGroupByCategoryName } from "../../utils" -import { locationSchema } from "./location" - -export const pointOfInterestSchema = z - .object({ - category: z.object({ - name: nullableStringValidator, - }), - distance: nullableNumberValidator, - location: locationSchema, - name: nullableStringValidator, - }) - .transform((poi) => ({ - categoryName: poi.category.name, - coordinates: { - lat: poi.location.latitude, - lng: poi.location.longitude, - }, - distance: poi.distance, - group: getPoiGroupByCategoryName(poi.category.name), - name: poi.name, - })) - -export const pointOfInterestsSchema = z - .array(pointOfInterestSchema) - .nullish() - .transform((arr) => (arr ? arr.filter(Boolean) : [])) - .transform((pois) => - pois.sort((a, b) => (a.distance ?? 0) - (b.distance ?? 0)) - ) diff --git a/apps/scandic-web/server/routers/hotels/schemas/meetingRoom.ts b/apps/scandic-web/server/routers/hotels/schemas/meetingRoom.ts index a08567a6c..01085a5c6 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/meetingRoom.ts +++ b/apps/scandic-web/server/routers/hotels/schemas/meetingRoom.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { imageSchema } from "./image" +import { imageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/image" export const meetingRoomsSchema = z.object({ data: z.array( diff --git a/apps/scandic-web/server/routers/hotels/utils.ts b/apps/scandic-web/server/routers/hotels/utils.ts index fe09cb6f2..d23fb86bd 100644 --- a/apps/scandic-web/server/routers/hotels/utils.ts +++ b/apps/scandic-web/server/routers/hotels/utils.ts @@ -1,49 +1,37 @@ -import deepmerge from "deepmerge" import stringify from "json-stable-stringify-without-jsonify" -import { Lang } from "@scandic-hotels/common/constants/language" import { getCacheClient } from "@scandic-hotels/common/dataCache" import { createCounter } from "@scandic-hotels/common/telemetry" +import * as api from "@scandic-hotels/trpc/api" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" import { badRequestError } from "@scandic-hotels/trpc/errors" +import { type RoomFeaturesInput } from "@scandic-hotels/trpc/routers/hotels/input" +import { + hotelsAvailabilitySchema, + packagesSchema, + roomFeaturesSchema, + roomsAvailabilitySchema, +} from "@scandic-hotels/trpc/routers/hotels/output" +import { toApiLang } from "@scandic-hotels/trpc/utils" +import { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs" import { BookingErrorCodeEnum, REDEMPTION } from "@/constants/booking" import { selectRate } from "@/constants/routes/hotelReservation" import { env } from "@/env/server" -import * as api from "@/lib/api" -import { toApiLang } from "@/server/utils" import { generateChildrenString } from "@/components/HotelReservation/utils" -import { cache } from "@/utils/cache" -import { chunk } from "@/utils/chunk" -import { sortRoomConfigs } from "@/utils/sort" -import { getHotelPageUrls } from "../contentstack/hotelPage/utils" -import { type RoomFeaturesInput } from "./input" -import { - type Cities, - citiesByCountrySchema, - citiesSchema, - countriesSchema, - getHotelIdsSchema, - hotelsAvailabilitySchema, - hotelSchema, - locationsSchema, - packagesSchema, - roomFeaturesSchema, - roomsAvailabilitySchema, -} from "./output" - -import type { z } from "zod" +import type { Room as RoomCategory } from "@scandic-hotels/trpc/types/hotel" +import type { + Product, + Products, + RateDefinition, + RedemptionsProduct, + RoomConfiguration, +} from "@scandic-hotels/trpc/types/roomAvailability" import type { BedTypeSelection } from "@/types/components/hotelReservation/enterDetails/bedType" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { HotelTypeEnum } from "@/types/enums/hotelType" -import { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest" -import type { - DestinationPagesHotelData, - Room as RoomCategory, -} from "@/types/hotel" import type { PackagesOutput } from "@/types/requests/packages" import type { HotelsAvailabilityInputSchema, @@ -52,529 +40,8 @@ import type { RoomsAvailabilityInputRoom, RoomsAvailabilityOutputSchema, } from "@/types/trpc/routers/hotel/availability" -import type { HotelInput } from "@/types/trpc/routers/hotel/hotel" -import type { - CitiesGroupedByCountry, - CityLocation, -} from "@/types/trpc/routers/hotel/locations" -import type { - Product, - Products, - RateDefinition, - RedemptionsProduct, - RoomConfiguration, -} from "@/types/trpc/routers/hotel/roomAvailability" -import type { Endpoint } from "@/lib/api/endpoints" - -export function getPoiGroupByCategoryName(category: string | undefined) { - if (!category) return PointOfInterestGroupEnum.LOCATION - switch (category) { - case "Airport": - case "Bus terminal": - case "Transportations": - return PointOfInterestGroupEnum.PUBLIC_TRANSPORT - case "Amusement park": - case "Museum": - case "Sports": - case "Theatre": - case "Tourist": - case "Zoo": - return PointOfInterestGroupEnum.ATTRACTIONS - case "Nearby companies": - case "Fair": - return PointOfInterestGroupEnum.BUSINESS - case "Parking / Garage": - return PointOfInterestGroupEnum.PARKING - case "Shopping": - case "Restaurant": - return PointOfInterestGroupEnum.SHOPPING_DINING - case "Hospital": - default: - return PointOfInterestGroupEnum.LOCATION - } -} - -export const locationsAffix = "locations" export const TWENTYFOUR_HOURS = 60 * 60 * 24 -export async function getCity({ - cityUrl, - serviceToken, -}: { - cityUrl: string - serviceToken: string -}): Promise { - const cacheClient = await getCacheClient() - return await cacheClient.cacheOrGet( - cityUrl, - async () => { - const url = new URL(cityUrl) - const cityResponse = await api.get( - url.pathname as Endpoint, - { headers: { Authorization: `Bearer ${serviceToken}` } }, - url.searchParams - ) - - if (!cityResponse.ok) { - return null - } - - const cityJson = await cityResponse.json() - const city = citiesSchema.safeParse(cityJson) - if (!city.success) { - console.info(`Validation of city failed`) - console.info(`cityUrl: ${cityUrl}`) - console.error(city.error) - return null - } - - return city.data - }, - "1d" - ) -} - -export async function getCountries({ - lang, - serviceToken, - warmup = false, -}: { - lang: Lang - serviceToken: string - warmup?: boolean -}) { - const cacheClient = await getCacheClient() - return await cacheClient.cacheOrGet( - `${lang}:${locationsAffix}:countries`, - async () => { - const params = new URLSearchParams({ - language: toApiLang(lang), - }) - - const countryResponse = await api.get( - api.endpoints.v1.Hotel.countries, - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - params - ) - - if (!countryResponse.ok) { - throw new Error("Unable to fetch countries") - } - - const countriesJson = await countryResponse.json() - const countries = countriesSchema.safeParse(countriesJson) - if (!countries.success) { - console.info(`Validation for countries failed`) - console.error(countries.error) - return null - } - - return countries.data - }, - "1d", - { - cacheStrategy: warmup ? "fetch-then-cache" : "cache-first", - } - ) -} - -export async function getCitiesByCountry({ - countries, - lang, - affix = locationsAffix, - serviceToken, -}: { - countries: string[] - lang: Lang - affix?: string - serviceToken: string -}): Promise { - const cacheClient = await getCacheClient() - const allCitiesByCountries = await Promise.all( - countries.map(async (country) => { - return cacheClient.cacheOrGet( - `${lang}:${affix}:cities-by-country:${country}`, - async () => { - const params = new URLSearchParams({ - language: toApiLang(lang), - }) - const countryResponse = await api.get( - api.endpoints.v1.Hotel.Cities.country(country), - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - params - ) - - if (!countryResponse.ok) { - throw new Error(`Unable to fetch cities by country ${country}`) - } - - const countryJson = await countryResponse.json() - const citiesByCountry = citiesByCountrySchema.safeParse(countryJson) - if (!citiesByCountry.success) { - console.error(`Unable to parse cities by country ${country}`) - console.error(citiesByCountry.error) - throw new Error(`Unable to parse cities by country ${country}`) - } - return { ...citiesByCountry.data, country } - }, - "1d" - ) - }) - ) - - const filteredCitiesByCountries = allCitiesByCountries.map((country) => ({ - ...country, - data: country.data.filter((city) => city.isPublished), - })) - - const groupedCitiesByCountry: CitiesGroupedByCountry = - filteredCitiesByCountries.reduce((acc, { country, data }) => { - acc[country] = data - return acc - }, {} as CitiesGroupedByCountry) - - return groupedCitiesByCountry -} - -export async function getLocations({ - lang, - citiesByCountry, - serviceToken, -}: { - lang: Lang - citiesByCountry: CitiesGroupedByCountry | null - serviceToken: string -}) { - const cacheClient = await getCacheClient() - const countryKeys = Object.keys(citiesByCountry ?? {}) - let cacheKey = `${lang}:locations` - - if (countryKeys.length) { - cacheKey += `:${countryKeys.join(",")}` - } - - return await cacheClient.cacheOrGet( - cacheKey.toLowerCase(), - async () => { - const params = new URLSearchParams({ - language: toApiLang(lang), - }) - - const apiResponse = await api.get( - api.endpoints.v1.Hotel.locations, - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - params - ) - if (!apiResponse.ok) { - if (apiResponse.status === 401) { - throw new Error("unauthorized") - } else if (apiResponse.status === 403) { - throw new Error("forbidden") - } - throw new Error("downstream error") - } - - const apiJson = await apiResponse.json() - const verifiedLocations = locationsSchema.safeParse(apiJson) - if (!verifiedLocations.success) { - console.info(`Locations Verification Failed`) - console.error(verifiedLocations.error) - throw new Error("Unable to parse locations") - } - const chunkedLocations = chunk(verifiedLocations.data.data, 10) - - let locations: z.infer["data"] = [] - - for (const chunk of chunkedLocations) { - const chunkLocations = await Promise.all( - chunk.map(async (location) => { - if (location.type === "cities") { - if (citiesByCountry) { - const country = Object.keys(citiesByCountry).find((country) => - citiesByCountry[country].find( - (loc) => loc.name === location.name - ) - ) - if (country) { - return { - ...location, - country, - } - } else { - console.info( - `Location cannot be found in any of the countries cities` - ) - console.info(location) - } - } - } else if (location.type === "hotels") { - if (location.relationships.city?.url) { - const city = await getCity({ - cityUrl: location.relationships.city.url, - serviceToken, - }) - if (city) { - return deepmerge(location, { - relationships: { - city, - }, - }) - } - } - } - - return location - }) - ) - - locations.push(...chunkLocations) - } - - return locations - }, - "1d" - ) -} - -export async function getHotelIdsByCityId({ - cityId, - serviceToken, -}: { - cityId: string - serviceToken: string -}) { - const getHotelIdsByCityIdCounter = createCounter( - "hotel", - "getHotelIdsByCityId" - ) - const metricsGetHotelIdsByCityId = getHotelIdsByCityIdCounter.init({ - cityId, - }) - - metricsGetHotelIdsByCityId.start() - - const cacheClient = await getCacheClient() - const result = await cacheClient.cacheOrGet( - `${cityId}:hotelsByCityId`, - async () => { - const searchParams = new URLSearchParams({ - city: cityId, - }) - - const apiResponse = await api.get( - api.endpoints.v1.Hotel.hotels, - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - searchParams - ) - - if (!apiResponse.ok) { - await metricsGetHotelIdsByCityId.httpError(apiResponse) - throw new Error("Unable to fetch hotelIds by cityId") - } - - const apiJson = await apiResponse.json() - const validatedHotelIds = getHotelIdsSchema.safeParse(apiJson) - if (!validatedHotelIds.success) { - metricsGetHotelIdsByCityId.validationError(validatedHotelIds.error) - throw new Error("Unable to parse data for hotelIds by cityId") - } - - return validatedHotelIds.data - }, - env.CACHE_TIME_HOTELS - ) - - metricsGetHotelIdsByCityId.success() - - return result -} - -export async function getHotelIdsByCountry({ - country, - serviceToken, -}: { - country: string - serviceToken: string -}) { - const getHotelIdsByCountryCounter = createCounter( - "hotel", - "getHotelIdsByCountry" - ) - - const metricsGetHotelIdsByCountry = getHotelIdsByCountryCounter.init({ - country, - }) - - metricsGetHotelIdsByCountry.start() - - const cacheClient = await getCacheClient() - - const result = await cacheClient.cacheOrGet( - `${country}:hotelsByCountry`, - async () => { - const hotelIdsParams = new URLSearchParams({ - country, - }) - - const apiResponse = await api.get( - api.endpoints.v1.Hotel.hotels, - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - hotelIdsParams - ) - - if (!apiResponse.ok) { - await metricsGetHotelIdsByCountry.httpError(apiResponse) - throw new Error("Unable to fetch hotelIds by country") - } - - const apiJson = await apiResponse.json() - const validatedHotelIds = getHotelIdsSchema.safeParse(apiJson) - if (!validatedHotelIds.success) { - metricsGetHotelIdsByCountry.validationError(validatedHotelIds.error) - throw new Error("Unable to parse hotelIds by country") - } - - return validatedHotelIds.data - }, - env.CACHE_TIME_HOTELS - ) - - metricsGetHotelIdsByCountry.success() - - return result -} - -export async function getHotelIdsByCityIdentifier( - cityIdentifier: string, - serviceToken: string -) { - const city = await getCityByCityIdentifier({ - cityIdentifier, - lang: Lang.en, - serviceToken, - }) - - if (!city) { - return [] - } - - const hotelIds = await getHotelIdsByCityId({ - cityId: city.id, - serviceToken, - }) - return hotelIds -} - -export async function getCityByCityIdentifier({ - cityIdentifier, - lang, - serviceToken, -}: { - cityIdentifier: string - lang: Lang - serviceToken: string -}) { - const locations = await getLocations({ - lang, - citiesByCountry: null, - serviceToken, - }) - if (!locations || "error" in locations) { - return null - } - - const city = locations - .filter((loc): loc is CityLocation => loc.type === "cities") - .find((loc) => loc.cityIdentifier === cityIdentifier) - - return city ?? null -} - -export async function getHotelsByHotelIds({ - hotelIds, - lang, - serviceToken, -}: { - hotelIds: string[] - lang: Lang - serviceToken: string -}) { - const cacheClient = await getCacheClient() - const cacheKey = `${lang}:getHotelsByHotelIds:hotels:${hotelIds.sort().join(",")}` - - return await cacheClient.cacheOrGet( - cacheKey, - async () => { - const hotelPages = await getHotelPageUrls(lang) - const chunkedHotelIds = chunk(hotelIds, 10) - - const hotels: DestinationPagesHotelData[] = [] - for (const hotelIdChunk of chunkedHotelIds) { - const chunkedHotels = await Promise.all( - hotelIdChunk.map(async (hotelId) => { - const hotelResponse = await getHotel( - { hotelId, language: lang, isCardOnlyPayment: false }, - serviceToken - ) - - if (!hotelResponse) { - throw new Error(`Hotel not found: ${hotelId}`) - } - - const hotelPage = hotelPages.find( - (page) => page.hotelId === hotelId - ) - const { hotel, cities } = hotelResponse - const data: DestinationPagesHotelData = { - hotel: { - id: hotel.id, - galleryImages: hotel.galleryImages, - name: hotel.name, - tripadvisor: hotel.ratings?.tripAdvisor?.rating, - detailedFacilities: hotel.detailedFacilities || [], - location: hotel.location, - hotelType: hotel.hotelType, - type: hotel.type, - address: hotel.address, - cityIdentifier: cities?.[0]?.cityIdentifier, - hotelDescription: hotel.hotelContent?.texts.descriptions?.short, - }, - url: hotelPage?.url ?? "", - } - - return data - }) - ) - - hotels.push(...chunkedHotels) - } - return hotels.filter( - (hotel): hotel is DestinationPagesHotelData => !!hotel - ) - }, - "1d" - ) -} function findProduct(product: Products, rateDefinition: RateDefinition) { if ("corporateCheque" in product) { @@ -604,89 +71,6 @@ function findProduct(product: Products, rateDefinition: RateDefinition) { } } -export const getHotel = cache( - async (input: HotelInput, serviceToken: string) => { - const { hotelId, language, isCardOnlyPayment } = input - - const getHotelCounter = createCounter("hotel", "getHotel") - const metricsGetHotel = getHotelCounter.init({ - hotelId, - language, - isCardOnlyPayment, - }) - - metricsGetHotel.start() - - const cacheClient = await getCacheClient() - - const result = await cacheClient.cacheOrGet( - `${input.language}:hotel:${input.hotelId}:${!!input.isCardOnlyPayment}`, - async () => { - /** - * Since API expects the params appended and not just - * a comma separated string we need to initialize the - * SearchParams with a sequence of pairs - * (include=City&include=NearbyHotels&include=Restaurants etc.) - **/ - const params = new URLSearchParams([ - ["include", "AdditionalData"], - ["include", "City"], - ["include", "NearbyHotels"], - ["include", "Restaurants"], - ["include", "RoomCategories"], - ["language", toApiLang(language)], - ]) - - const apiResponse = await api.get( - api.endpoints.v1.Hotel.Hotels.hotel(hotelId), - { - headers: { - Authorization: `Bearer ${serviceToken}`, - }, - }, - params - ) - - if (!apiResponse.ok) { - await metricsGetHotel.httpError(apiResponse) - return null - } - - const apiJson = await apiResponse.json() - const validateHotelData = hotelSchema.safeParse(apiJson) - - if (!validateHotelData.success) { - metricsGetHotel.validationError(validateHotelData.error) - throw badRequestError() - } - - const hotelData = validateHotelData.data - - if (isCardOnlyPayment) { - hotelData.hotel.merchantInformationData.alternatePaymentOptions = [] - } - - const gallery = hotelData.additionalData?.gallery - if (gallery) { - const smallerImages = gallery.smallerImages - const hotelGalleryImages = - hotelData.hotel.hotelType === HotelTypeEnum.Signature - ? smallerImages.slice(0, 10) - : smallerImages.slice(0, 6) - hotelData.hotel.galleryImages = hotelGalleryImages - } - - return hotelData - }, - env.CACHE_TIME_HOTELS - ) - - metricsGetHotel.success() - - return result - } -) - export async function getHotelsAvailabilityByCity( input: HotelsAvailabilityInputSchema, apiLang: string, diff --git a/apps/scandic-web/server/routers/partners/jobylon/output.ts b/apps/scandic-web/server/routers/partners/jobylon/output.ts index 958736c4a..6ef69117d 100644 --- a/apps/scandic-web/server/routers/partners/jobylon/output.ts +++ b/apps/scandic-web/server/routers/partners/jobylon/output.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" const categoriesSchema = z .array( diff --git a/apps/scandic-web/server/routers/partners/sas/linkAccount.ts b/apps/scandic-web/server/routers/partners/sas/linkAccount.ts index 77ff9a029..00713df37 100644 --- a/apps/scandic-web/server/routers/partners/sas/linkAccount.ts +++ b/apps/scandic-web/server/routers/partners/sas/linkAccount.ts @@ -1,10 +1,9 @@ import * as Sentry from "@sentry/nextjs" import { z } from "zod" +import * as api from "@scandic-hotels/trpc/api" import { protectedProcedure } from "@scandic-hotels/trpc/procedures" -import * as api from "@/lib/api" - import { getOTPState } from "./otp/getOTPState" import { getSasToken } from "./getSasToken" diff --git a/apps/scandic-web/server/routers/partners/sas/performLevelUpgrade.ts b/apps/scandic-web/server/routers/partners/sas/performLevelUpgrade.ts index b1c40ba2a..966cde952 100644 --- a/apps/scandic-web/server/routers/partners/sas/performLevelUpgrade.ts +++ b/apps/scandic-web/server/routers/partners/sas/performLevelUpgrade.ts @@ -2,10 +2,10 @@ import * as Sentry from "@sentry/nextjs" import { cookies } from "next/headers" import { z } from "zod" +import * as api from "@scandic-hotels/trpc/api" import { protectedProcedure } from "@scandic-hotels/trpc/procedures" import { FriendsMembershipLevels } from "@/constants/membershipLevels" -import * as api from "@/lib/api" import { getUserSchema } from "../../user/output" import { getVerifiedUser } from "../../user/utils" diff --git a/apps/scandic-web/server/routers/partners/sas/transferPoints.ts b/apps/scandic-web/server/routers/partners/sas/transferPoints.ts index f83cfdc0b..4ff8109ff 100644 --- a/apps/scandic-web/server/routers/partners/sas/transferPoints.ts +++ b/apps/scandic-web/server/routers/partners/sas/transferPoints.ts @@ -1,12 +1,10 @@ import * as Sentry from "@sentry/nextjs" import { z } from "zod" +import * as api from "@scandic-hotels/trpc/api" import { protectedProcedure } from "@scandic-hotels/trpc/procedures" -import * as api from "@/lib/api" - import { getOTPState } from "./otp/getOTPState" -// import * as api from "@/lib/api" import { getSasToken } from "./getSasToken" const outputSchema = z.object({ diff --git a/apps/scandic-web/server/routers/partners/sas/unlinkAccount.ts b/apps/scandic-web/server/routers/partners/sas/unlinkAccount.ts index 78ee9a03d..e504cf61d 100644 --- a/apps/scandic-web/server/routers/partners/sas/unlinkAccount.ts +++ b/apps/scandic-web/server/routers/partners/sas/unlinkAccount.ts @@ -1,9 +1,8 @@ import { z } from "zod" +import * as api from "@scandic-hotels/trpc/api" import { protectedProcedure } from "@scandic-hotels/trpc/procedures" -import * as api from "@/lib/api" - import { getOTPState } from "./otp/getOTPState" import { getSasToken } from "./getSasToken" diff --git a/apps/scandic-web/server/routers/user/mutation.ts b/apps/scandic-web/server/routers/user/mutation.ts index 00137de29..e15ee6588 100644 --- a/apps/scandic-web/server/routers/user/mutation.ts +++ b/apps/scandic-web/server/routers/user/mutation.ts @@ -1,5 +1,6 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" +import * as api from "@scandic-hotels/trpc/api" import { serverErrorByStatus } from "@scandic-hotels/trpc/errors" import { protectedProcedure, @@ -8,7 +9,6 @@ import { import { signupVerify } from "@/constants/routes/signup" import { env } from "@/env/server" -import * as api from "@/lib/api" import { initiateSaveCardSchema, subscriberIdSchema, diff --git a/apps/scandic-web/server/routers/user/output.ts b/apps/scandic-web/server/routers/user/output.ts index 9a3faace8..c01236949 100644 --- a/apps/scandic-web/server/routers/user/output.ts +++ b/apps/scandic-web/server/routers/user/output.ts @@ -1,11 +1,11 @@ import { z } from "zod" +import { imageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/image" + import { countriesMap } from "@/constants/countries" import { getFriendsMembership } from "@/utils/user" -import { imageSchema } from "../hotels/schemas/image" - const scandicFriendsTier = z.enum(["L1", "L2", "L3", "L4", "L5", "L6", "L7"]) const sasEurobonusTier = z.enum(["EBB", "EBS", "EBG", "EBD", "EBP"]) diff --git a/apps/scandic-web/server/routers/user/query.ts b/apps/scandic-web/server/routers/user/query.ts index 07e835c99..699edb51f 100644 --- a/apps/scandic-web/server/routers/user/query.ts +++ b/apps/scandic-web/server/routers/user/query.ts @@ -1,13 +1,12 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" +import * as api from "@scandic-hotels/trpc/api" import { languageProtectedProcedure, protectedProcedure, safeProtectedProcedure, } from "@scandic-hotels/trpc/procedures" - -import * as api from "@/lib/api" -import { toApiLang } from "@/server/utils" +import { toApiLang } from "@scandic-hotels/trpc/utils" import { isValidSession } from "@/utils/session" import { getFriendsMembership, getMembershipCards } from "@/utils/user" diff --git a/apps/scandic-web/server/routers/user/utils.ts b/apps/scandic-web/server/routers/user/utils.ts index 0e3b469c7..ff596c704 100644 --- a/apps/scandic-web/server/routers/user/utils.ts +++ b/apps/scandic-web/server/routers/user/utils.ts @@ -1,12 +1,12 @@ +import { myStay } from "@scandic-hotels/common/constants/routes/myStay" +import { dt } from "@scandic-hotels/common/dt" import { createCounter } from "@scandic-hotels/common/telemetry" +import * as api from "@scandic-hotels/trpc/api" +import { toApiLang } from "@scandic-hotels/trpc/utils" import { countries } from "@/constants/countries" import { myBookingPath } from "@/constants/myBooking" -import { myStay } from "@/constants/routes/myStay" import { env } from "@/env/server" -import * as api from "@/lib/api" -import { dt } from "@/lib/dt" -import { toApiLang } from "@/server/utils" import { cache } from "@/utils/cache" import { encrypt } from "@/utils/encryption" diff --git a/apps/scandic-web/server/utils.ts b/apps/scandic-web/server/utils.ts index a6b4bea82..4ff740f4f 100644 --- a/apps/scandic-web/server/utils.ts +++ b/apps/scandic-web/server/utils.ts @@ -1,7 +1,4 @@ import { NextRequest } from "next/server" -import { z } from "zod" - -import { Lang } from "@scandic-hotels/common/constants/language" import { env } from "@/env/server" @@ -9,38 +6,6 @@ export function isDefined(argument: T | undefined | null): argument is T { return argument !== undefined && argument !== null } -export const langInput = z.object({ - lang: z.nativeEnum(Lang), -}) - -/** - * Helper function to convert Lang enum to API lang enum. - */ -export const toApiLang = (lang: Lang): string => { - const result = toApiLangMap[lang] - if (!result) { - throw new Error("Invalid language") - } - return result -} - -const toApiLangMap: { [key in Lang]: string } = { - [Lang.en]: "En", - [Lang.sv]: "Sv", - [Lang.no]: "No", - [Lang.fi]: "Fi", - [Lang.da]: "Da", - [Lang.de]: "De", -} - -/** - * Helper function to convert lang string to Lang enum. - */ -export function toLang(lang: string): Lang | undefined { - const lowerCaseLang = lang.toLowerCase() - return Object.values(Lang).find((l) => l === lowerCaseLang) -} - /** * Use this function when you want to create URLs that are public facing, for * example for redirects or redirectTo query parameters. diff --git a/apps/scandic-web/services/warmup/warmupCountries.ts b/apps/scandic-web/services/warmup/warmupCountries.ts index a6371a31b..e448498a7 100644 --- a/apps/scandic-web/services/warmup/warmupCountries.ts +++ b/apps/scandic-web/services/warmup/warmupCountries.ts @@ -1,6 +1,5 @@ import { getServiceToken } from "@scandic-hotels/common/tokenManager" - -import { getCountries } from "@/server/routers/hotels/utils" +import { getCountries } from "@scandic-hotels/trpc/routers/hotels/utils" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/services/warmup/warmupHotelIdsByCountry.ts b/apps/scandic-web/services/warmup/warmupHotelIdsByCountry.ts index 58a4526df..bb2e810be 100644 --- a/apps/scandic-web/services/warmup/warmupHotelIdsByCountry.ts +++ b/apps/scandic-web/services/warmup/warmupHotelIdsByCountry.ts @@ -1,11 +1,10 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { getServiceToken } from "@scandic-hotels/common/tokenManager" import { safeTry } from "@scandic-hotels/common/utils/safeTry" - import { getCountries, getHotelIdsByCountry, -} from "@/server/routers/hotels/utils" +} from "@scandic-hotels/trpc/routers/hotels/utils" import type { WarmupFunction, WarmupResult } from "." diff --git a/apps/scandic-web/stores/destination-data/helper.ts b/apps/scandic-web/stores/destination-data/helper.ts index 5cc290d8d..842e06b25 100644 --- a/apps/scandic-web/stores/destination-data/helper.ts +++ b/apps/scandic-web/stores/destination-data/helper.ts @@ -1,11 +1,9 @@ -import type { - CategorizedFilters, - Filter, - SortItem, -} from "@/types/components/destinationFilterAndSort" -import { SortOption } from "@/types/enums/destinationFilterAndSort" -import type { DestinationPagesHotelData } from "@/types/hotel" -import type { DestinationCityListItem } from "@/types/trpc/routers/contentstack/destinationCityPage" +import { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort" + +import type { DestinationCityListItem } from "@scandic-hotels/trpc/types/destinationCityPage" +import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel" + +import type { SortItem } from "@/types/components/destinationFilterAndSort" const HOTEL_SORTING_STRATEGIES: Partial< Record< @@ -24,38 +22,6 @@ const HOTEL_SORTING_STRATEGIES: Partial< }, } -const CITY_SORTING_STRATEGIES: Partial< - Record< - SortOption, - (a: DestinationCityListItem, b: DestinationCityListItem) => number - > -> = { - [SortOption.Name]: function (a, b) { - return a.cityName.localeCompare(b.cityName) - }, - [SortOption.Recommended]: function (a, b) { - if (a.sort_order === null && b.sort_order === null) { - return a.cityName.localeCompare(b.cityName) - } - if (a.sort_order === null) { - return 1 - } - if (b.sort_order === null) { - return -1 - } - return b.sort_order - a.sort_order - }, -} - -function sortFilters(filters: Filter[]): Filter[] { - return [...filters].sort((a, b) => { - // First sort by sortOrder - const orderDiff = a.sortOrder - b.sortOrder - // If sortOrder is the same, sort by name as secondary criterion - return orderDiff === 0 ? a.name.localeCompare(b.name) : orderDiff - }) -} - export function getFilteredHotels( hotels: DestinationPagesHotelData[], filters: string[] @@ -85,14 +51,6 @@ export function getFilteredCities( ) } -export function getSortedCities( - cities: DestinationCityListItem[], - sortOption: SortOption -) { - const sortFn = CITY_SORTING_STRATEGIES[sortOption] - return sortFn ? cities.sort(sortFn) : cities -} - export function getSortedHotels( hotels: DestinationPagesHotelData[], sortOption: SortOption @@ -108,59 +66,6 @@ export function isValidSortOption( return sortItems.map((item) => item.value).includes(value as SortOption) } -const HOTEL_SURROUNDINGS_FILTER_TYPE_NAMES = [ - "Hotel surroundings", - "Hotel omgivelser", - "Hotelumgebung", - "Hotellia lähellä", - "Hotellomgivelser", - "Omgivningar", -] - -const HOTEL_FACILITIES_FILTER_TYPE_NAMES = [ - "Hotel facilities", - "Hotellfaciliteter", - "Hotelfaciliteter", - "Hotel faciliteter", - "Hotel-Infos", - "Hotellin palvelut", -] - -export function getFiltersFromHotels( - hotels: DestinationPagesHotelData[] -): CategorizedFilters { - if (hotels.length === 0) { - return { facilityFilters: [], surroundingsFilters: [] } - } - - const filters = hotels.flatMap(({ hotel }) => hotel.detailedFacilities) - const uniqueFilterNames = [...new Set(filters.map((filter) => filter.name))] - const filterList = uniqueFilterNames - .map((filterName) => { - const filter = filters.find((filter) => filter.name === filterName) - return filter - ? { - name: filter.name, - slug: filter.slug, - filterType: filter.filter, - sortOrder: filter.sortOrder, - } - : null - }) - .filter((filter): filter is Filter => !!filter) - - const facilityFilters = filterList.filter((filter) => - HOTEL_FACILITIES_FILTER_TYPE_NAMES.includes(filter.filterType) - ) - const surroundingsFilters = filterList.filter((filter) => - HOTEL_SURROUNDINGS_FILTER_TYPE_NAMES.includes(filter.filterType) - ) - return { - facilityFilters: sortFilters(facilityFilters), - surroundingsFilters: sortFilters(surroundingsFilters), - } -} - export function getBasePathNameWithoutFilters( pathname: string, filterSlugs: string[] diff --git a/apps/scandic-web/stores/destination-data/index.ts b/apps/scandic-web/stores/destination-data/index.ts index 6d5eec251..d9e7dc3bc 100644 --- a/apps/scandic-web/stores/destination-data/index.ts +++ b/apps/scandic-web/stores/destination-data/index.ts @@ -2,6 +2,8 @@ import { produce } from "immer" import { useContext } from "react" import { create, useStore } from "zustand" +import { getSortedCities } from "@scandic-hotels/trpc/utils/getSortedCities" + import { DestinationDataContext } from "@/contexts/DestinationData" import { trackFilterChangeEvent, @@ -12,12 +14,12 @@ import { getBasePathNameWithoutFilters, getFilteredCities, getFilteredHotels, - getSortedCities, getSortedHotels, isValidSortOption, } from "./helper" -import type { Filter } from "@/types/components/destinationFilterAndSort" +import type { Filter } from "@scandic-hotels/trpc/types/destinationFilterAndSort" + import type { DestinationDataState, InitialState, diff --git a/apps/scandic-web/stores/enter-details/helpers.ts b/apps/scandic-web/stores/enter-details/helpers.ts index c1b756bab..9a79a8821 100644 --- a/apps/scandic-web/stores/enter-details/helpers.ts +++ b/apps/scandic-web/stores/enter-details/helpers.ts @@ -1,6 +1,9 @@ import isEqual from "fast-deep-equal" import { parsePhoneNumberFromString } from "libphonenumber-js" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { RateTypeEnum } from "@scandic-hotels/trpc/enums/rateType" + import { sumPackages, sumPackagesRequestedPrice, @@ -8,20 +11,19 @@ import { import { detailsStorageName } from "." -import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" -import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details" -import type { Price } from "@/types/components/hotelReservation/price" -import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" -import { CurrencyEnum } from "@/types/enums/currency" -import { RateTypeEnum } from "@/types/enums/rateType" -import type { Packages } from "@/types/requests/packages" -import type { PersistedState, RoomState } from "@/types/stores/enter-details" import type { CorporateChequeProduct, PriceProduct, RedemptionProduct, VoucherProduct, -} from "@/types/trpc/routers/hotel/roomAvailability" +} from "@scandic-hotels/trpc/types/roomAvailability" + +import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" +import { type RoomRate } from "@/types/components/hotelReservation/enterDetails/details" +import type { Price } from "@/types/components/hotelReservation/price" +import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate" +import type { Packages } from "@/types/requests/packages" +import type { PersistedState, RoomState } from "@/types/stores/enter-details" import type { SafeUser } from "@/types/user" export function extractGuestFromUser(user: NonNullable) { diff --git a/apps/scandic-web/stores/enter-details/index.ts b/apps/scandic-web/stores/enter-details/index.ts index 1eeb964df..bc14ec83c 100644 --- a/apps/scandic-web/stores/enter-details/index.ts +++ b/apps/scandic-web/stores/enter-details/index.ts @@ -4,7 +4,7 @@ import { useContext } from "react" import { create, useStore } from "zustand" import { getDefaultCountryFromLang } from "@/constants/languages" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import { DetailsContext } from "@/contexts/Details" diff --git a/apps/scandic-web/stores/my-stay/add-ancillary-flow.ts b/apps/scandic-web/stores/my-stay/add-ancillary-flow.ts index 2c92f812e..9aef7bedc 100644 --- a/apps/scandic-web/stores/my-stay/add-ancillary-flow.ts +++ b/apps/scandic-web/stores/my-stay/add-ancillary-flow.ts @@ -10,7 +10,7 @@ import type { Ancillary, SelectedAncillary, } from "@/types/components/myPages/myStay/ancillaries" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import type { Room } from "@/types/stores/my-stay" export enum AncillaryStepEnum { diff --git a/apps/scandic-web/stores/my-stay/helpers.ts b/apps/scandic-web/stores/my-stay/helpers.ts index caea7317f..5117db2dd 100644 --- a/apps/scandic-web/stores/my-stay/helpers.ts +++ b/apps/scandic-web/stores/my-stay/helpers.ts @@ -1,8 +1,9 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" + import { formatPrice } from "@/utils/numberFormatting" import type { IntlShape } from "react-intl" -import { CurrencyEnum } from "@/types/enums/currency" import type { Room } from "@/types/stores/my-stay" export function calculateTotalPrice( diff --git a/apps/scandic-web/stores/select-rate/helpers.ts b/apps/scandic-web/stores/select-rate/helpers.ts index ad5e93723..429facffc 100644 --- a/apps/scandic-web/stores/select-rate/helpers.ts +++ b/apps/scandic-web/stores/select-rate/helpers.ts @@ -1,10 +1,10 @@ -import { CurrencyEnum } from "@/types/enums/currency" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import type { AvailabilityError } from "@/types/stores/rates" import type { Product, RoomConfiguration, RoomsAvailability, -} from "@/types/trpc/routers/hotel/roomAvailability" +} from "@scandic-hotels/trpc/types/roomAvailability" export function findProduct( rateCode: string, diff --git a/apps/scandic-web/stores/select-rate/index.ts b/apps/scandic-web/stores/select-rate/index.ts index adea53cbd..500abae37 100644 --- a/apps/scandic-web/stores/select-rate/index.ts +++ b/apps/scandic-web/stores/select-rate/index.ts @@ -2,6 +2,9 @@ import { produce } from "immer" import { useContext } from "react" import { create, useStore } from "zustand" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" +import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" + import { REDEMPTION } from "@/constants/booking" import { RatesContext } from "@/contexts/Rates" @@ -13,12 +16,11 @@ import { findSelectedRate, } from "./helpers" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" +import type { PriceProduct } from "@scandic-hotels/trpc/types/roomAvailability" + import { BookingCodeFilterEnum } from "@/types/enums/bookingCodeFilter" import type { Package, Packages } from "@/types/requests/packages" import type { InitialState, RatesState } from "@/types/stores/rates" -import type { PriceProduct } from "@/types/trpc/routers/hotel/roomAvailability" export function createRatesStore({ booking, diff --git a/apps/scandic-web/types/components/blocks/Accordion.ts b/apps/scandic-web/types/components/blocks/Accordion.ts index 669b28b1d..43faba016 100644 --- a/apps/scandic-web/types/components/blocks/Accordion.ts +++ b/apps/scandic-web/types/components/blocks/Accordion.ts @@ -1,4 +1,4 @@ -import type { Accordion } from "@/server/routers/contentstack/schemas/blocks/accordion" +import type { Accordion } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/accordion" export type AccordionProps = { accordion: Accordion["accordion"]["accordions"] diff --git a/apps/scandic-web/types/components/blocks/index.ts b/apps/scandic-web/types/components/blocks/index.ts index 0360c31b8..8519d0a46 100644 --- a/apps/scandic-web/types/components/blocks/index.ts +++ b/apps/scandic-web/types/components/blocks/index.ts @@ -1,12 +1,12 @@ -import type { Block as AccountPageBlock } from "@/types/trpc/routers/contentstack/accountPage" -import type { Block as CampaignPageBlock } from "@/types/trpc/routers/contentstack/campaignPage" -import type { Block as CollectionPageBlock } from "@/types/trpc/routers/contentstack/collectionPage" -import type { Block as ContentPageBlock } from "@/types/trpc/routers/contentstack/contentPage" -import type { Block as DestinationCityPageBlock } from "@/types/trpc/routers/contentstack/destinationCityPage" -import type { Block as DestinationCountryPageBlock } from "@/types/trpc/routers/contentstack/destinationCountryPage" -import type { Block as DestinationOverviewPageBlock } from "@/types/trpc/routers/contentstack/destinationOverviewPage" -import type { Block as LoyaltyPageBlock } from "@/types/trpc/routers/contentstack/loyaltyPage" -import type { Block as StartPageBlock } from "@/types/trpc/routers/contentstack/startPage" +import type { Block as StartPageBlock } from "@scandic-hotels/trpc/routers/contentstack/startPage/query" +import type { Block as AccountPageBlock } from "@scandic-hotels/trpc/types/accountPage" +import type { Block as CampaignPageBlock } from "@scandic-hotels/trpc/types/campaignPage" +import type { Block as CollectionPageBlock } from "@scandic-hotels/trpc/types/collectionPage" +import type { Block as ContentPageBlock } from "@scandic-hotels/trpc/types/contentPage" +import type { Block as DestinationCityPageBlock } from "@scandic-hotels/trpc/types/destinationCityPage" +import type { Block as DestinationCountryPageBlock } from "@scandic-hotels/trpc/types/destinationCountryPage" +import type { Block as DestinationOverviewPageBlock } from "@scandic-hotels/trpc/types/destinationOverviewPage" +import type { Block as LoyaltyPageBlock } from "@scandic-hotels/trpc/types/loyaltyPage" export type Blocks = | AccountPageBlock diff --git a/apps/scandic-web/types/components/blocks/infoCard.ts b/apps/scandic-web/types/components/blocks/infoCard.ts index 53d267d87..20318767b 100644 --- a/apps/scandic-web/types/components/blocks/infoCard.ts +++ b/apps/scandic-web/types/components/blocks/infoCard.ts @@ -1,6 +1,6 @@ +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" import type { VariantProps } from "class-variance-authority" -import type { ImageVaultAsset } from "@/types/components/imageVault" import type { CardProps } from "@/components/TempDesignSystem/Card/card" import type { cardVariants } from "@/components/TempDesignSystem/Card/variants" diff --git a/apps/scandic-web/types/components/blocks/surprises.ts b/apps/scandic-web/types/components/blocks/surprises.ts index 397cb5e51..9416866b2 100644 --- a/apps/scandic-web/types/components/blocks/surprises.ts +++ b/apps/scandic-web/types/components/blocks/surprises.ts @@ -1,4 +1,4 @@ -import type { Surprise } from "../myPages/rewards" +import type { Surprise } from "@scandic-hotels/trpc/types/rewards" export interface SurprisesProps { surprises: Surprise[] diff --git a/apps/scandic-web/types/components/contentPage/hotelListingItem.ts b/apps/scandic-web/types/components/contentPage/hotelListingItem.ts index baeaa2ed0..dd957efea 100644 --- a/apps/scandic-web/types/components/contentPage/hotelListingItem.ts +++ b/apps/scandic-web/types/components/contentPage/hotelListingItem.ts @@ -1,4 +1,5 @@ -import type { AdditionalData, Hotel } from "@/types/hotel" +import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel" + import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks" export interface HotelListingItemProps { diff --git a/apps/scandic-web/types/components/current/asides/contact.ts b/apps/scandic-web/types/components/current/asides/contact.ts index 37f06ed0f..27f43577d 100644 --- a/apps/scandic-web/types/components/current/asides/contact.ts +++ b/apps/scandic-web/types/components/current/asides/contact.ts @@ -1,4 +1,4 @@ import type { ContactNode } from "@/types/requests/asides/contact" -import type { Node } from "@/types/requests/utils/edges" +import type { Node } from "@scandic-hotels/trpc/types/edges" export type ContactsProps = { contacts: Node[] } diff --git a/apps/scandic-web/types/components/current/footer.ts b/apps/scandic-web/types/components/current/footer.ts index 426ed796d..d4d214854 100644 --- a/apps/scandic-web/types/components/current/footer.ts +++ b/apps/scandic-web/types/components/current/footer.ts @@ -1,4 +1,4 @@ -import type { NavigationItem } from "@/server/routers/contentstack/base/output" +import type { NavigationItem } from "@scandic-hotels/trpc/routers/contentstack/base/output" export type FooterNavigationProps = { linkGroups: NavigationItem[] diff --git a/apps/scandic-web/types/components/current/header/mainMenu.ts b/apps/scandic-web/types/components/current/header/mainMenu.ts index 55e4e362b..7dc36c422 100644 --- a/apps/scandic-web/types/components/current/header/mainMenu.ts +++ b/apps/scandic-web/types/components/current/header/mainMenu.ts @@ -1,4 +1,5 @@ -import type { Image } from "@/types/image" +import type { Image } from "@scandic-hotels/trpc/types/image" + import type { CurrentHeaderLink, TopMenuHeaderLink, diff --git a/apps/scandic-web/types/components/current/hero.ts b/apps/scandic-web/types/components/current/hero.ts index 04ef27c4a..0d1efc6d9 100644 --- a/apps/scandic-web/types/components/current/hero.ts +++ b/apps/scandic-web/types/components/current/hero.ts @@ -1,4 +1,4 @@ -import type { Image } from "@/types/image" +import type { Image } from "@scandic-hotels/trpc/types/image" export type HeroProps = { images: { diff --git a/apps/scandic-web/types/components/current/languageSwitcher.ts b/apps/scandic-web/types/components/current/languageSwitcher.ts index 44b49fff6..2f06df145 100644 --- a/apps/scandic-web/types/components/current/languageSwitcher.ts +++ b/apps/scandic-web/types/components/current/languageSwitcher.ts @@ -1,4 +1,4 @@ -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" +import type { LanguageSwitcherData } from "@scandic-hotels/trpc/types/languageSwitcher" export type LanguageSwitcherLink = { href: string diff --git a/apps/scandic-web/types/components/deprecatedjsontohtml.ts b/apps/scandic-web/types/components/deprecatedjsontohtml.ts index 201485cb2..2f1b71f40 100644 --- a/apps/scandic-web/types/components/deprecatedjsontohtml.ts +++ b/apps/scandic-web/types/components/deprecatedjsontohtml.ts @@ -1,5 +1,5 @@ import type { Embeds } from "@/types/requests/embeds" -import type { Node } from "@/types/requests/utils/edges" +import type { Node } from "@scandic-hotels/trpc/types/edges" import type { RTENode } from "../rte/node" import type { RenderOptions } from "../rte/option" diff --git a/apps/scandic-web/types/components/destinationFilterAndSort.ts b/apps/scandic-web/types/components/destinationFilterAndSort.ts index eb2bae554..ab68133ad 100644 --- a/apps/scandic-web/types/components/destinationFilterAndSort.ts +++ b/apps/scandic-web/types/components/destinationFilterAndSort.ts @@ -1,19 +1,7 @@ -import type { SortOption } from "../enums/destinationFilterAndSort" +import type { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort" export interface SortItem { label: string value: SortOption isDefault?: boolean } - -export interface Filter { - name: string - slug: string - filterType: string - sortOrder: number -} - -export interface CategorizedFilters { - facilityFilters: Filter[] - surroundingsFilters: Filter[] -} diff --git a/apps/scandic-web/types/components/header/megaMenu.ts b/apps/scandic-web/types/components/header/megaMenu.ts index 924dbb654..53af330f6 100644 --- a/apps/scandic-web/types/components/header/megaMenu.ts +++ b/apps/scandic-web/types/components/header/megaMenu.ts @@ -1,4 +1,4 @@ -import type { MenuItem } from "@/types/trpc/routers/contentstack/header" +import type { MenuItem } from "@scandic-hotels/trpc/types/header" export interface MegaMenuProps { title: MenuItem["title"] diff --git a/apps/scandic-web/types/components/header/mobileMenu.ts b/apps/scandic-web/types/components/header/mobileMenu.ts index 85b08844a..1ae6423ee 100644 --- a/apps/scandic-web/types/components/header/mobileMenu.ts +++ b/apps/scandic-web/types/components/header/mobileMenu.ts @@ -1,4 +1,4 @@ -import type { Header } from "@/types/trpc/routers/contentstack/header" +import type { Header } from "@scandic-hotels/trpc/types/header" export interface MobileMenuProps { topLink: Header["header"]["topLink"] diff --git a/apps/scandic-web/types/components/header/navigationMenuItem.ts b/apps/scandic-web/types/components/header/navigationMenuItem.ts index 6cfe3cb60..45f772ae4 100644 --- a/apps/scandic-web/types/components/header/navigationMenuItem.ts +++ b/apps/scandic-web/types/components/header/navigationMenuItem.ts @@ -1,4 +1,4 @@ -import type { MenuItem } from "@/types/trpc/routers/contentstack/header" +import type { MenuItem } from "@scandic-hotels/trpc/types/header" export interface NavigationMenuItemProps { item: MenuItem diff --git a/apps/scandic-web/types/components/header/navigationMenuList.ts b/apps/scandic-web/types/components/header/navigationMenuList.ts index 363ecbb59..86730c717 100644 --- a/apps/scandic-web/types/components/header/navigationMenuList.ts +++ b/apps/scandic-web/types/components/header/navigationMenuList.ts @@ -1,4 +1,4 @@ -import type { MenuItem } from "@/types/trpc/routers/contentstack/header" +import type { MenuItem } from "@scandic-hotels/trpc/types/header" export interface NavigationMenuListProps { isMobile: boolean diff --git a/apps/scandic-web/types/components/header/topLink.ts b/apps/scandic-web/types/components/header/topLink.ts index 5f9e855da..a9672d629 100644 --- a/apps/scandic-web/types/components/header/topLink.ts +++ b/apps/scandic-web/types/components/header/topLink.ts @@ -1,4 +1,4 @@ -import type { Header } from "@/types/trpc/routers/contentstack/header" +import type { Header } from "@scandic-hotels/trpc/types/header" export interface TopLinkProps { isLoggedIn: boolean diff --git a/apps/scandic-web/types/components/headers/dynamicContent.ts b/apps/scandic-web/types/components/headers/dynamicContent.ts index ef89d3f41..aebfb736f 100644 --- a/apps/scandic-web/types/components/headers/dynamicContent.ts +++ b/apps/scandic-web/types/components/headers/dynamicContent.ts @@ -1,5 +1,5 @@ import type { z } from "zod" -import type { dynamicContentSchema } from "@/server/routers/contentstack/schemas/headers/dynamicContent" +import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/headers/dynamicContent" export type HeaderDynamicContentProps = z.infer diff --git a/apps/scandic-web/types/components/hotelPage/amenities.ts b/apps/scandic-web/types/components/hotelPage/amenities.ts index b394576f6..33de666ad 100644 --- a/apps/scandic-web/types/components/hotelPage/amenities.ts +++ b/apps/scandic-web/types/components/hotelPage/amenities.ts @@ -1,4 +1,4 @@ -import type { Amenities } from "@/types/hotel" +import type { Amenities } from "@scandic-hotels/trpc/types/hotel" export type AmenitiesListProps = { detailedFacilities: Amenities diff --git a/apps/scandic-web/types/components/hotelPage/facilities.ts b/apps/scandic-web/types/components/hotelPage/facilities.ts index 3dbcf4d30..336394552 100644 --- a/apps/scandic-web/types/components/hotelPage/facilities.ts +++ b/apps/scandic-web/types/components/hotelPage/facilities.ts @@ -1,5 +1,9 @@ -import type { Amenities, Facility, HealthFacilities } from "@/types/hotel" -import type { ActivitiesCard } from "@/types/trpc/routers/contentstack/hotelPage" +import type { + Amenities, + Facility, + HealthFacilities, +} from "@scandic-hotels/trpc/types/hotel" +import type { ActivitiesCard } from "@scandic-hotels/trpc/types/hotelPage" import type { CardProps } from "@/components/TempDesignSystem/Card/card" export type FacilitiesProps = { diff --git a/apps/scandic-web/types/components/hotelPage/map/interactiveMap.ts b/apps/scandic-web/types/components/hotelPage/map/interactiveMap.ts index 528ed9bf5..1190ce255 100644 --- a/apps/scandic-web/types/components/hotelPage/map/interactiveMap.ts +++ b/apps/scandic-web/types/components/hotelPage/map/interactiveMap.ts @@ -1,9 +1,9 @@ +import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" +import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker" import type { ReactElement } from "react" import type { HotelPin } from "@/types/components/hotelReservation/selectHotel/map" import type { Coordinates } from "@/types/components/maps/coordinates" -import type { MarkerInfo } from "@/types/components/maps/marker" -import type { PointOfInterest } from "@/types/hotel" export interface InteractiveMapProps { coordinates: Coordinates diff --git a/apps/scandic-web/types/components/hotelPage/map/mapCard.ts b/apps/scandic-web/types/components/hotelPage/map/mapCard.ts index 1ead43544..3ad27372b 100644 --- a/apps/scandic-web/types/components/hotelPage/map/mapCard.ts +++ b/apps/scandic-web/types/components/hotelPage/map/mapCard.ts @@ -1,4 +1,4 @@ -import type { PointOfInterest } from "@/types/hotel" +import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" export interface MapCardProps { hotelName: string diff --git a/apps/scandic-web/types/components/hotelPage/map/sidebar.ts b/apps/scandic-web/types/components/hotelPage/map/sidebar.ts index 5fd700d4a..3649aeebc 100644 --- a/apps/scandic-web/types/components/hotelPage/map/sidebar.ts +++ b/apps/scandic-web/types/components/hotelPage/map/sidebar.ts @@ -1,4 +1,4 @@ -import type { PointOfInterest } from "@/types/hotel" +import type { PointOfInterest } from "@scandic-hotels/trpc/types/hotel" import type { Coordinates } from "../../maps/coordinates" export interface SidebarProps { diff --git a/apps/scandic-web/types/components/hotelPage/map/staticMap.ts b/apps/scandic-web/types/components/hotelPage/map/staticMap.ts index 80bd15dd7..338cea57e 100644 --- a/apps/scandic-web/types/components/hotelPage/map/staticMap.ts +++ b/apps/scandic-web/types/components/hotelPage/map/staticMap.ts @@ -1,4 +1,5 @@ -import type { MarkerInfo } from "@/types/components/maps/marker" +import type { MarkerInfo } from "@scandic-hotels/trpc/types/marker" + import type { Coordinates } from "../../maps/coordinates" export type StaticMapProps = { diff --git a/apps/scandic-web/types/components/hotelPage/previewImages.ts b/apps/scandic-web/types/components/hotelPage/previewImages.ts index 497121f35..df632a35e 100644 --- a/apps/scandic-web/types/components/hotelPage/previewImages.ts +++ b/apps/scandic-web/types/components/hotelPage/previewImages.ts @@ -1,4 +1,4 @@ -import type { ApiImage } from "@/types/hotel" +import type { ApiImage } from "@scandic-hotels/trpc/types/hotel" export type PreviewImagesProps = { images: ApiImage[] diff --git a/apps/scandic-web/types/components/hotelPage/room.ts b/apps/scandic-web/types/components/hotelPage/room.ts index 0a8a8031c..515262a66 100644 --- a/apps/scandic-web/types/components/hotelPage/room.ts +++ b/apps/scandic-web/types/components/hotelPage/room.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" export interface RoomCardProps { room: Room diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/aboutTheHotel.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/aboutTheHotel.ts index d2ceae322..ff55f01a0 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/aboutTheHotel.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/aboutTheHotel.ts @@ -1,4 +1,8 @@ -import type { Hotel, HotelAddress, HotelLocation } from "@/types/hotel" +import type { + Hotel, + HotelAddress, + HotelLocation, +} from "@scandic-hotels/trpc/types/hotel" export type AboutTheHotelSidePeekProps = { hotelAddress: HotelAddress diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts index 5d18670c0..f120b769b 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/amenities.ts @@ -3,7 +3,7 @@ import type { DetailedFacility, Hotel, Restaurant, -} from "@/types/hotel" +} from "@scandic-hotels/trpc/types/hotel" import type { ParkingAmenityProps } from "./parking" export type AmenitiesSidePeekProps = { diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/facility.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/facility.ts index 6cb6f0796..bd2aef83f 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/facility.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/facility.ts @@ -1,4 +1,4 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export type FacilityProps = { data: Hotel["healthFacilities"][number] diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/meetingsAndConferences.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/meetingsAndConferences.ts index 3e681e4a1..f3d15da29 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/meetingsAndConferences.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/meetingsAndConferences.ts @@ -1,4 +1,4 @@ -import type { AdditionalData, Hotel } from "@/types/hotel" +import type { AdditionalData, Hotel } from "@scandic-hotels/trpc/types/hotel" import type { MeetingRooms } from "../meetingRooms" export type MeetingsAndConferencesSidePeekProps = { diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts index 6e7bf5a00..17d5846bb 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/parking.ts @@ -1,4 +1,4 @@ -import type { Hotel, Parking } from "@/types/hotel" +import type { Hotel, Parking } from "@scandic-hotels/trpc/types/hotel" export enum Periods { allDay = "AllDay", diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/restaurantBar.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/restaurantBar.ts index f30200456..476801da1 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/restaurantBar.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/restaurantBar.ts @@ -1,4 +1,4 @@ -import type { Restaurant } from "@/types/hotel" +import type { Restaurant } from "@scandic-hotels/trpc/types/hotel" export interface RestaurantBarSidePeekProps { restaurants: Restaurant[] diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/room.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/room.ts index 833ed335c..f314fab74 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/room.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/room.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" export interface RoomSidePeekProps { room: Room diff --git a/apps/scandic-web/types/components/hotelPage/sidepeek/wellnessAndExercise.ts b/apps/scandic-web/types/components/hotelPage/sidepeek/wellnessAndExercise.ts index 9d29980e1..baa7d4bd1 100644 --- a/apps/scandic-web/types/components/hotelPage/sidepeek/wellnessAndExercise.ts +++ b/apps/scandic-web/types/components/hotelPage/sidepeek/wellnessAndExercise.ts @@ -1,4 +1,4 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export type WellnessAndExerciseSidePeekProps = { healthFacilities: Hotel["healthFacilities"] diff --git a/apps/scandic-web/types/components/hotelReservation/amenitiesSidePeek.ts b/apps/scandic-web/types/components/hotelReservation/amenitiesSidePeek.ts index f8cf9da6f..b83c45b5a 100644 --- a/apps/scandic-web/types/components/hotelReservation/amenitiesSidePeek.ts +++ b/apps/scandic-web/types/components/hotelReservation/amenitiesSidePeek.ts @@ -1,5 +1,9 @@ import type { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek" -import type { AdditionalData, Hotel, Restaurant } from "@/types/hotel" +import type { + AdditionalData, + Hotel, + Restaurant, +} from "@scandic-hotels/trpc/types/hotel" export type AmenitiesSidePeekProps = { hotel: Hotel & { url: string | null } diff --git a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/bookingConfirmation.ts b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/bookingConfirmation.ts index e042fa1bc..078e1aa68 100644 --- a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/bookingConfirmation.ts +++ b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/bookingConfirmation.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { BookingConfirmation, BookingConfirmationSchema, diff --git a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts index a6ce40f75..a9996abbb 100644 --- a/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts +++ b/apps/scandic-web/types/components/hotelReservation/bookingConfirmation/rooms.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" export interface BookingConfirmationRoomsProps diff --git a/apps/scandic-web/types/components/hotelReservation/breakfast.ts b/apps/scandic-web/types/components/hotelReservation/breakfast.ts index 9813c8131..7defda500 100644 --- a/apps/scandic-web/types/components/hotelReservation/breakfast.ts +++ b/apps/scandic-web/types/components/hotelReservation/breakfast.ts @@ -1,8 +1,8 @@ +import type { breakfastPackagesSchema } from "@scandic-hotels/trpc/routers/hotels/output" +import type { breakfastPackageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/packages" import type { z } from "zod" import type { breakfastFormSchema } from "@/components/HotelReservation/EnterDetails/Breakfast/schema" -import type { breakfastPackagesSchema } from "@/server/routers/hotels/output" -import type { breakfastPackageSchema } from "@/server/routers/hotels/schemas/packages" export interface BreakfastFormSchema extends z.output {} diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts index 88ce100d5..56c7e049e 100644 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts +++ b/apps/scandic-web/types/components/hotelReservation/enterDetails/details.ts @@ -1,14 +1,14 @@ import type { z } from "zod" import type { PackageEnum } from "@/types/requests/packages" -import type { Product } from "@/types/trpc/routers/hotel/roomAvailability" +import type { Product } from "@scandic-hotels/trpc/types/roomAvailability" import type { SafeUser } from "@/types/user" import type { getMultiroomDetailsSchema } from "@/components/HotelReservation/EnterDetails/Details/Multiroom/schema" import type { guestDetailsSchema, signedInDetailsSchema, } from "@/components/HotelReservation/EnterDetails/Details/RoomOne/schema" -import type { productTypePointsSchema } from "@/server/routers/hotels/schemas/productTypePrice" +import type { productTypePointsSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice" import type { BookingSearchType } from "../booking" import type { Price } from "../price" import type { Child } from "../selectRate/selectRate" diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts index f8a15e87c..26291ff06 100644 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts +++ b/apps/scandic-web/types/components/hotelReservation/enterDetails/hotelHeader.ts @@ -1,4 +1,4 @@ -import type { HotelData } from "@/types/hotel" +import type { HotelData } from "@scandic-hotels/trpc/types/hotel" export interface HotelHeaderProps { hotelData: HotelData diff --git a/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts b/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts index 816eb1aa4..9716b20e4 100644 --- a/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts +++ b/apps/scandic-web/types/components/hotelReservation/enterDetails/payment.ts @@ -1,5 +1,6 @@ +import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" + import type { CreditCard } from "@/types/user" -import type { PaymentMethodEnum } from "@/constants/booking" export interface PaymentProps { otherPaymentOptions: PaymentMethodEnum[] diff --git a/apps/scandic-web/types/components/hotelReservation/hotelSidePeek.ts b/apps/scandic-web/types/components/hotelReservation/hotelSidePeek.ts index 24a71105c..e06c5480d 100644 --- a/apps/scandic-web/types/components/hotelReservation/hotelSidePeek.ts +++ b/apps/scandic-web/types/components/hotelReservation/hotelSidePeek.ts @@ -1,5 +1,9 @@ import type { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek" -import type { AdditionalData, Hotel, Restaurant } from "@/types/hotel" +import type { + AdditionalData, + Hotel, + Restaurant, +} from "@scandic-hotels/trpc/types/hotel" export type HotelSidePeekProps = { hotel: Hotel & { url: string | null } diff --git a/apps/scandic-web/types/components/hotelReservation/myStay/cancelStay.ts b/apps/scandic-web/types/components/hotelReservation/myStay/cancelStay.ts index e1af10f26..53c1a4b30 100644 --- a/apps/scandic-web/types/components/hotelReservation/myStay/cancelStay.ts +++ b/apps/scandic-web/types/components/hotelReservation/myStay/cancelStay.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export const cancelStaySchema = z.object({ rooms: z.array( diff --git a/apps/scandic-web/types/components/hotelReservation/myStay/receipt.ts b/apps/scandic-web/types/components/hotelReservation/myStay/receipt.ts index 4f74a399a..e8d798794 100644 --- a/apps/scandic-web/types/components/hotelReservation/myStay/receipt.ts +++ b/apps/scandic-web/types/components/hotelReservation/myStay/receipt.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" import type { Ancillaries } from "../../myPages/myStay/ancillaries" diff --git a/apps/scandic-web/types/components/hotelReservation/price.ts b/apps/scandic-web/types/components/hotelReservation/price.ts index 08a12bef6..9b13c710b 100644 --- a/apps/scandic-web/types/components/hotelReservation/price.ts +++ b/apps/scandic-web/types/components/hotelReservation/price.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { CurrencyEnum } from "@/types/enums/currency" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" interface TPrice { additionalPrice?: number diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/filterAndSortModal.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/filterAndSortModal.ts index a36cc23eb..362d543dc 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/filterAndSortModal.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/filterAndSortModal.ts @@ -1,6 +1,6 @@ -import type { CategorizedFilters } from "./hotelFilters" +import type { CategorizedHotelFilters } from "./hotelFilters" export type FilterAndSortModalProps = { - filters: CategorizedFilters + filters: CategorizedHotelFilters setShowSkeleton?: (showSkeleton: boolean) => void } diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts index 999dbadb9..b1019bc5c 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelCardListingProps.ts @@ -1,4 +1,4 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" import type { ProductType } from "@/types/trpc/routers/hotel/availability" import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers" diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelFilters.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelFilters.ts index a485d585b..f34ce61a4 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelFilters.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/hotelFilters.ts @@ -1,19 +1,20 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export type HotelFilter = Hotel["detailedFacilities"][number] & { hotelId: string hotelIds: string[] } -export type CategorizedFilters = { +export type CategorizedHotelFilters = { facilityFilters: HotelFilter[] surroundingsFilters: HotelFilter[] } + export type HotelFiltersProps = { - filters: CategorizedFilters + filters: CategorizedHotelFilters className?: string } export type HotelFilterModalProps = { - filters: CategorizedFilters + filters: CategorizedHotelFilters } diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts index 918ab3724..0fdd1e173 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts @@ -1,11 +1,11 @@ +import type { imageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/image" +import type { Amenities } from "@scandic-hotels/trpc/types/hotel" import type { z } from "zod" import type { Coordinates } from "@/types/components/maps/coordinates" -import type { Amenities } from "@/types/hotel" import type { ProductTypeCheque } from "@/types/trpc/routers/hotel/availability" import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers" -import type { imageSchema } from "@/server/routers/hotels/schemas/image" -import type { CategorizedFilters } from "./hotelFilters" +import type { CategorizedHotelFilters } from "./hotelFilters" import type { SelectHotelBooking } from "./selectHotel" export interface HotelListingProps { @@ -18,7 +18,7 @@ export interface SelectHotelMapProps { hotelPins: HotelPin[] mapId: string hotels: HotelResponse[] - filterList: CategorizedFilters + filterList: CategorizedHotelFilters cityCoordinates: Coordinates bookingCode: string | undefined isBookingCodeRateAvailable?: boolean diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/noAvailabilityAlert.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/noAvailabilityAlert.ts index 5fd9fce1a..6019fde02 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/noAvailabilityAlert.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/noAvailabilityAlert.ts @@ -1,4 +1,4 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" export type NoAvailabilityAlertProp = { hotelsLength: number diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/selectHotel.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/selectHotel.ts index 3c89285ab..dc8072ed7 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectHotel/selectHotel.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/selectHotel.ts @@ -1,13 +1,8 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" import type { BookingSearchType } from "../booking" import type { Child } from "../selectRate/selectRate" import type { SidePeekEnum } from "../sidePeek" -export enum AvailabilityEnum { - Available = "Available", - NotAvailable = "NotAvailable", -} - export interface ReadMoreProps { label: string hotelId: string diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts index 2acbc62fa..dc822cda9 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/hotelInfoCard.ts @@ -1,4 +1,5 @@ -import type { Hotel } from "@/types/hotel" +import type { Hotel } from "@scandic-hotels/trpc/types/hotel" + import type { SelectRateBooking } from "./selectRate" export interface HotelInfoCardProps { diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/rates.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/rates.ts index b6ac2c147..9025efb05 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/rates.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/rates.ts @@ -1,7 +1,7 @@ import type { Product, RoomConfiguration, -} from "@/types/trpc/routers/hotel/roomAvailability" +} from "@scandic-hotels/trpc/types/roomAvailability" export interface RatesProps { roomConfiguration: RoomConfiguration diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts index 02c687391..9ee75e0b3 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/roomFilter.ts @@ -1,22 +1,6 @@ import type { z } from "zod" -import type { packageSchema } from "@/server/routers/hotels/schemas/packages" +import type { packageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/packages" -export enum RoomPackageCodeEnum { - PET_ROOM = "PETR", - ALLERGY_ROOM = "ALLG", - ACCESSIBILITY_ROOM = "ACCE", -} - -export interface DefaultFilterOptions { - code: RoomPackageCodeEnum - description: string -} - -export type FilterValues = { - [K in RoomPackageCodeEnum]?: boolean -} - -export type RoomPackage = z.output +type RoomPackage = z.output export type RoomPackageCodes = RoomPackage["code"] -export type RoomPackages = RoomPackage[] diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/roomListItem.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/roomListItem.ts index 6db8d337f..91a3b45ed 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/roomListItem.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/roomListItem.ts @@ -1,5 +1,5 @@ import type { Package } from "@/types/requests/packages" -import type { RoomConfiguration } from "@/types/trpc/routers/hotel/roomAvailability" +import type { RoomConfiguration } from "@scandic-hotels/trpc/types/roomAvailability" export type RoomListItemProps = { roomConfiguration: RoomConfiguration diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/roomsContainer.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/roomsContainer.ts index 5908f25a8..570598d9c 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/roomsContainer.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/roomsContainer.ts @@ -1,4 +1,4 @@ -import type { HotelData } from "@/types/hotel" +import type { HotelData } from "@scandic-hotels/trpc/types/hotel" export interface RoomsContainerProps extends Pick, diff --git a/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts b/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts index f57c0dcb0..1b465ef41 100644 --- a/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts +++ b/apps/scandic-web/types/components/hotelReservation/selectRate/selectRate.ts @@ -1,10 +1,11 @@ -import type { RateEnum } from "@/types/enums/rate" -import type { PackageEnum, Packages } from "@/types/requests/packages" +import type { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" +import type { RateEnum } from "@scandic-hotels/trpc/enums/rate" import type { Product, RoomConfiguration, -} from "@/types/trpc/routers/hotel/roomAvailability" -import type { ChildBedMapEnum } from "../../bookingWidget/enums" +} from "@scandic-hotels/trpc/types/roomAvailability" + +import type { PackageEnum, Packages } from "@/types/requests/packages" import type { BookingSearchType } from "../booking" export interface Child { diff --git a/apps/scandic-web/types/components/hotelReservation/summary.ts b/apps/scandic-web/types/components/hotelReservation/summary.ts index cd086c332..6b600d309 100644 --- a/apps/scandic-web/types/components/hotelReservation/summary.ts +++ b/apps/scandic-web/types/components/hotelReservation/summary.ts @@ -1,4 +1,4 @@ -import type { CurrencyEnum } from "@/types/enums/currency" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import type { Packages } from "@/types/requests/packages" import type { RoomState } from "@/types/stores/enter-details" import type { diff --git a/apps/scandic-web/types/components/image.ts b/apps/scandic-web/types/components/image.ts index 941886a75..220e598f5 100644 --- a/apps/scandic-web/types/components/image.ts +++ b/apps/scandic-web/types/components/image.ts @@ -1,17 +1,13 @@ +import type { FocalPoint } from "@scandic-hotels/trpc/types/image" import type { ImageProps as NextImageProps } from "next/image" -export interface FocalPoint { - x: number - y: number -} - -export interface Dimensions { +interface Dimensions { width: number height: number aspectRatio: number } -export interface Meta { +interface Meta { alt: string | undefined | null caption: string | undefined | null } diff --git a/apps/scandic-web/types/components/imageContainer.ts b/apps/scandic-web/types/components/imageContainer.ts index bd4ea2ab1..e5141e363 100644 --- a/apps/scandic-web/types/components/imageContainer.ts +++ b/apps/scandic-web/types/components/imageContainer.ts @@ -1,4 +1,4 @@ -import type { ImageVaultAsset } from "./imageVault" +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" export type ImageContainerProps = { leftImage: ImageVaultAsset diff --git a/apps/scandic-web/types/components/languageSwitcher/languageSwitcher.ts b/apps/scandic-web/types/components/languageSwitcher/languageSwitcher.ts index 36aa2f9a3..49aac80fb 100644 --- a/apps/scandic-web/types/components/languageSwitcher/languageSwitcher.ts +++ b/apps/scandic-web/types/components/languageSwitcher/languageSwitcher.ts @@ -1,7 +1,6 @@ +import type { LanguageSwitcherData } from "@scandic-hotels/trpc/types/languageSwitcher" import type { ReactElement } from "react" -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" - export enum LanguageSwitcherTypesEnum { MobileHeader = "mobileHeader", DesktopHeader = "desktopHeader", diff --git a/apps/scandic-web/types/components/mapLocation.ts b/apps/scandic-web/types/components/mapLocation.ts index b78ceb325..95cc01db5 100644 --- a/apps/scandic-web/types/components/mapLocation.ts +++ b/apps/scandic-web/types/components/mapLocation.ts @@ -1,5 +1,5 @@ import type { z } from "zod" -import type { mapLocationSchema } from "@/server/routers/contentstack/schemas/mapLocation" +import type { mapLocationSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/mapLocation" export type MapLocation = z.output diff --git a/apps/scandic-web/types/components/maps/destinationMarkers.ts b/apps/scandic-web/types/components/maps/destinationMarkers.ts index 2cd0eab76..09729a8ef 100644 --- a/apps/scandic-web/types/components/maps/destinationMarkers.ts +++ b/apps/scandic-web/types/components/maps/destinationMarkers.ts @@ -1,6 +1,6 @@ import type { FeatureCollection, Point } from "geojson" -import type { Amenities } from "@/types/hotel" +import type { Amenities } from "@scandic-hotels/trpc/types/hotel" import type { GalleryImage } from "../imageGallery" export interface DestinationMarker { diff --git a/apps/scandic-web/types/components/maps/poiMarker.ts b/apps/scandic-web/types/components/maps/poiMarker.ts index 3d33caeb4..aa77bdcac 100644 --- a/apps/scandic-web/types/components/maps/poiMarker.ts +++ b/apps/scandic-web/types/components/maps/poiMarker.ts @@ -1,6 +1,6 @@ +import type { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest" import type { VariantProps } from "class-variance-authority" -import type { PointOfInterestGroupEnum } from "@/types/enums/pointOfInterest" import type { poiVariants } from "@/components/Maps/Markers/Poi/variants" export interface PoiMarkerProps extends VariantProps { diff --git a/apps/scandic-web/types/components/myPages/membership.ts b/apps/scandic-web/types/components/myPages/membership.ts index 7b99392b5..71b2faf3b 100644 --- a/apps/scandic-web/types/components/myPages/membership.ts +++ b/apps/scandic-web/types/components/myPages/membership.ts @@ -1,5 +1,6 @@ +import type { MembershipLevel } from "@scandic-hotels/common/constants/membershipLevels" + import type { LevelProps } from "@/components/Levels/levels" -import type { MembershipLevel } from "@/constants/membershipLevels" export type MembershipLevelIconProps = { level: MembershipLevel diff --git a/apps/scandic-web/types/components/myPages/myPage/accountPage.ts b/apps/scandic-web/types/components/myPages/myPage/accountPage.ts index dfe2575c1..be6e8ecca 100644 --- a/apps/scandic-web/types/components/myPages/myPage/accountPage.ts +++ b/apps/scandic-web/types/components/myPages/myPage/accountPage.ts @@ -1,9 +1,9 @@ +import type { blocksSchema } from "@scandic-hotels/trpc/routers/contentstack/accountPage/output" +import type { Reward } from "@scandic-hotels/trpc/types/rewards" import type { Dispatch, SetStateAction } from "react" import type { z } from "zod" import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks" -import type { blocksSchema } from "@/server/routers/contentstack/accountPage/output" -import type { Reward } from "../rewards" export interface AccountPageContentProps extends Pick {} diff --git a/apps/scandic-web/types/components/myPages/myStay/ancillaries.ts b/apps/scandic-web/types/components/myPages/myStay/ancillaries.ts index 4bdf267d0..5504172f1 100644 --- a/apps/scandic-web/types/components/myPages/myStay/ancillaries.ts +++ b/apps/scandic-web/types/components/myPages/myStay/ancillaries.ts @@ -5,7 +5,7 @@ import type { CreditCard, User } from "@/types/user" import type { ancillaryPackagesSchema, packagesSchema, -} from "@/server/routers/hotels/output" +} from "@scandic-hotels/trpc/routers/hotels/output" export type Ancillaries = z.output export type Ancillary = Ancillaries[number] diff --git a/apps/scandic-web/types/components/myPages/rewards.ts b/apps/scandic-web/types/components/myPages/rewards.ts deleted file mode 100644 index e24856a3e..000000000 --- a/apps/scandic-web/types/components/myPages/rewards.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - type RESTAURANT_REWARD_IDS, - type REWARD_IDS, -} from "@/constants/rewards" - -import type { LogoAndIllustrationProps } from "@scandic-hotels/design-system/Icons" - -import type { - ApiReward, - BenefitReward, - CMSReward, - CouponReward, -} from "@/types/trpc/routers/contentstack/reward" - -export type { BaseReward, Campaign, Reward, Surprise, Tier } - -export interface RewardIconProps extends LogoAndIllustrationProps { - rewardId: string - iconSize?: "small" | "medium" | "large" -} - -export type RewardId = (typeof REWARD_IDS)[keyof typeof REWARD_IDS] - -export type RestaurantRewardId = (typeof RESTAURANT_REWARD_IDS)[number] - -type BaseReward = ApiReward & CMSReward -type Campaign = CouponReward & - CMSReward & { - rewardType: "Campaign" - } -type Surprise = CouponReward & - CMSReward & { - rewardType: "Surprise" - } -type Tier = BenefitReward & - CMSReward & { - rewardType: "Tier" - } -type MemberVoucher = CouponReward & - CMSReward & { - rewardType: "Member-voucher" - } -type Reward = Campaign | Surprise | Tier | MemberVoucher diff --git a/apps/scandic-web/types/components/overviewTable.ts b/apps/scandic-web/types/components/overviewTable.ts index d63f5be51..a60307e2e 100644 --- a/apps/scandic-web/types/components/overviewTable.ts +++ b/apps/scandic-web/types/components/overviewTable.ts @@ -1,9 +1,8 @@ +import type { MembershipLevel } from "@scandic-hotels/common/constants/membershipLevels" +import type { LevelWithRewards } from "@scandic-hotels/trpc/routers/contentstack/loyaltyLevel/output" +import type { CMSReward } from "@scandic-hotels/trpc/types/reward" import type { JSX } from "react" -import type { MembershipLevel } from "@/constants/membershipLevels" -import type { LoyaltyLevel } from "@/server/routers/contentstack/loyaltyLevel/output" -import type { CMSReward } from "../trpc/routers/contentstack/reward" - export type OverviewTableClientProps = { activeMembership: MembershipLevel | null levels: ComparisonLevel[] @@ -13,8 +12,6 @@ export type LevelCardProps = { level: LevelWithRewards } -export type LevelWithRewards = LoyaltyLevel & { rewards: CMSReward[] } - export type ComparisonLevel = LevelWithRewards export type LevelSummaryProps = { diff --git a/apps/scandic-web/types/components/sidePeeks/amenities.ts b/apps/scandic-web/types/components/sidePeeks/amenities.ts index 5f7390ce1..4b060a333 100644 --- a/apps/scandic-web/types/components/sidePeeks/amenities.ts +++ b/apps/scandic-web/types/components/sidePeeks/amenities.ts @@ -3,7 +3,7 @@ import type { DetailedFacility, Parking, Restaurant, -} from "@/types/hotel" +} from "@scandic-hotels/trpc/types/hotel" export interface ParkingAccordionItemProps { parkingPageHref?: string | null diff --git a/apps/scandic-web/types/components/sidePeeks/bookedRoomSidePeek.ts b/apps/scandic-web/types/components/sidePeeks/bookedRoomSidePeek.ts index dbcb348ec..129ddd031 100644 --- a/apps/scandic-web/types/components/sidePeeks/bookedRoomSidePeek.ts +++ b/apps/scandic-web/types/components/sidePeeks/bookedRoomSidePeek.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { SafeUser } from "@/types/user" export type BookedRoomSidePeekProps = { diff --git a/apps/scandic-web/types/components/sidePeeks/roomSidePeek.ts b/apps/scandic-web/types/components/sidePeeks/roomSidePeek.ts index cd978578f..df630b0fb 100644 --- a/apps/scandic-web/types/components/sidePeeks/roomSidePeek.ts +++ b/apps/scandic-web/types/components/sidePeeks/roomSidePeek.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { SidePeekEnum } from "../hotelReservation/sidePeek" export type RoomSidePeekProps = { diff --git a/apps/scandic-web/types/components/sidebar/index.ts b/apps/scandic-web/types/components/sidebar/index.ts index 43e250d2c..7de515372 100644 --- a/apps/scandic-web/types/components/sidebar/index.ts +++ b/apps/scandic-web/types/components/sidebar/index.ts @@ -1,5 +1,5 @@ -import type { SidebarBlock as ContentPageSidebarBlock } from "@/types/trpc/routers/contentstack/contentPage" -import type { SidebarBlock as LoyaltyPageSidebarBlock } from "@/types/trpc/routers/contentstack/loyaltyPage" +import type { SidebarBlock as ContentPageSidebarBlock } from "@scandic-hotels/trpc/types/contentPage" +import type { SidebarBlock as LoyaltyPageSidebarBlock } from "@scandic-hotels/trpc/types/loyaltyPage" export type Blocks = ContentPageSidebarBlock | LoyaltyPageSidebarBlock diff --git a/apps/scandic-web/types/components/sidebar/joinLoyaltyContact.ts b/apps/scandic-web/types/components/sidebar/joinLoyaltyContact.ts index b826220ae..80195a398 100644 --- a/apps/scandic-web/types/components/sidebar/joinLoyaltyContact.ts +++ b/apps/scandic-web/types/components/sidebar/joinLoyaltyContact.ts @@ -1,8 +1,9 @@ +import type { ContactFields } from "@scandic-hotels/trpc/routers/contentstack/base/output" + import type { Contacts, JoinLoyaltyContact, } from "@/types/trpc/routers/contentstack/sidebar" -import type { ContactFields } from "@/server/routers/contentstack/base/output" export interface JoinLoyaltyContactProps { block: JoinLoyaltyContact["join_loyalty_contact"] diff --git a/apps/scandic-web/types/components/teaserCard.ts b/apps/scandic-web/types/components/teaserCard.ts index 14d62ca17..a209db057 100644 --- a/apps/scandic-web/types/components/teaserCard.ts +++ b/apps/scandic-web/types/components/teaserCard.ts @@ -1,6 +1,6 @@ +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" import type { VariantProps } from "class-variance-authority" -import type { ImageVaultAsset } from "@/types/components/imageVault" import type { CardProps } from "@/components/TempDesignSystem/Card/card" import type { teaserCardVariants } from "@/components/TempDesignSystem/TeaserCard/variants" import type { TeaserCard } from "../trpc/routers/contentstack/blocks" diff --git a/apps/scandic-web/types/components/tracking.ts b/apps/scandic-web/types/components/tracking.ts index 8bb4eaecc..0555bd136 100644 --- a/apps/scandic-web/types/components/tracking.ts +++ b/apps/scandic-web/types/components/tracking.ts @@ -1,7 +1,6 @@ import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { MembershipLevel } from "@/constants/membershipLevels" -import type { RateEnum } from "../enums/rate" +import type { MembershipLevel } from "@scandic-hotels/common/constants/membershipLevels" +import type { RateEnum } from "@scandic-hotels/trpc/enums/rate" export enum TrackingChannelEnum { "scandic-friends" = "scandic-friends", diff --git a/apps/scandic-web/types/discriminatedUnion.ts b/apps/scandic-web/types/discriminatedUnion.ts deleted file mode 100644 index 86ef7df88..000000000 --- a/apps/scandic-web/types/discriminatedUnion.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ZodDiscriminatedUnionOption, ZodError } from "zod" - -export interface DiscriminatedUnionError { - error: ZodError -} - -export interface Option extends ZodDiscriminatedUnionOption<"__typename"> {} diff --git a/apps/scandic-web/types/enums/alert.ts b/apps/scandic-web/types/enums/alert.ts index 0db07bd04..c624a2e2b 100644 --- a/apps/scandic-web/types/enums/alert.ts +++ b/apps/scandic-web/types/enums/alert.ts @@ -1,10 +1,3 @@ -export enum AlertTypeEnum { - Info = "info", - Warning = "warning", - Alarm = "alarm", - Success = "success", -} - export const AlertName = { HotelChildrenInBooking: "HotelChildrenInBooking", } as const diff --git a/apps/scandic-web/types/enums/campaignPage.ts b/apps/scandic-web/types/enums/campaignPage.ts deleted file mode 100644 index 000b6eb26..000000000 --- a/apps/scandic-web/types/enums/campaignPage.ts +++ /dev/null @@ -1,10 +0,0 @@ -export namespace CampaignPageEnum { - export namespace ContentStack { - export const enum blocks { - Essentials = "CampaignPageBlocksEssentials", - CarouselCards = "CampaignPageBlocksCarouselCards", - Accordion = "CampaignPageBlocksAccordion", - HotelListing = "CampaignPageBlocksHotelListing", - } - } -} diff --git a/apps/scandic-web/types/enums/collectionPage.ts b/apps/scandic-web/types/enums/collectionPage.ts deleted file mode 100644 index 567a8a457..000000000 --- a/apps/scandic-web/types/enums/collectionPage.ts +++ /dev/null @@ -1,10 +0,0 @@ -export namespace CollectionPageEnum { - export namespace ContentStack { - export const enum blocks { - CardsGrid = "CollectionPageBlocksCardsGrid", - DynamicContent = "CollectionPageBlocksDynamicContent", - Shortcuts = "CollectionPageBlocksShortcuts", - UspGrid = "CollectionPageBlocksUspGrid", - } - } -} diff --git a/apps/scandic-web/types/enums/destinationCityPage.ts b/apps/scandic-web/types/enums/destinationCityPage.ts deleted file mode 100644 index 696420f60..000000000 --- a/apps/scandic-web/types/enums/destinationCityPage.ts +++ /dev/null @@ -1,8 +0,0 @@ -export namespace DestinationCityPageEnum { - export namespace ContentStack { - export const enum blocks { - Accordion = "DestinationCityPageBlocksAccordion", - Content = "DestinationCityPageBlocksContent", - } - } -} diff --git a/apps/scandic-web/types/enums/destinationCountryPage.ts b/apps/scandic-web/types/enums/destinationCountryPage.ts deleted file mode 100644 index 7fe2b5406..000000000 --- a/apps/scandic-web/types/enums/destinationCountryPage.ts +++ /dev/null @@ -1,8 +0,0 @@ -export namespace DestinationCountryPageEnum { - export namespace ContentStack { - export const enum blocks { - Accordion = "DestinationCountryPageBlocksAccordion", - Content = "DestinationCountryPageBlocksContent", - } - } -} diff --git a/apps/scandic-web/types/enums/destinationOverviewPage.ts b/apps/scandic-web/types/enums/destinationOverviewPage.ts deleted file mode 100644 index 274f7a606..000000000 --- a/apps/scandic-web/types/enums/destinationOverviewPage.ts +++ /dev/null @@ -1,7 +0,0 @@ -export namespace DestinationOverviewPageEnum { - export namespace ContentStack { - export const enum blocks { - CardGallery = "DestinationOverviewPageBlocksCardGallery", - } - } -} diff --git a/apps/scandic-web/types/enums/hotelPage.ts b/apps/scandic-web/types/enums/hotelPage.ts index 0b1c0260b..e1752f4fc 100644 --- a/apps/scandic-web/types/enums/hotelPage.ts +++ b/apps/scandic-web/types/enums/hotelPage.ts @@ -1,13 +1,3 @@ -export namespace HotelPageEnum { - export namespace ContentStack { - export const enum blocks { - Faq = "HotelPageFaq", - ActivitiesCard = "HotelPageContentUpcomingActivitiesCard", - SpaPage = "HotelPageContentSpaPage", - } - } -} - export const HotelHashValues = { overview: "overview", rooms: "rooms", diff --git a/apps/scandic-web/types/enums/startPage.ts b/apps/scandic-web/types/enums/startPage.ts deleted file mode 100644 index da55c58ca..000000000 --- a/apps/scandic-web/types/enums/startPage.ts +++ /dev/null @@ -1,10 +0,0 @@ -export namespace StartPageEnum { - export namespace ContentStack { - export const enum blocks { - CardsGrid = "StartPageBlocksCardsGrid", - CarouselCards = "StartPageBlocksCarouselCards", - FullWidthCampaign = "StartPageBlocksFullWidthCampaign", - JoinScandicFriends = "StartPageBlocksJoinScandicFriends", - } - } -} diff --git a/apps/scandic-web/types/fetch.ts b/apps/scandic-web/types/fetch.ts deleted file mode 100644 index a727709a9..000000000 --- a/apps/scandic-web/types/fetch.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface RequestOptionsWithJSONBody - extends Omit { - body?: Record -} - -export interface RequestOptionsWithOutBody - extends Omit {} diff --git a/apps/scandic-web/types/params.ts b/apps/scandic-web/types/params.ts index 545504899..21b214ffb 100644 --- a/apps/scandic-web/types/params.ts +++ b/apps/scandic-web/types/params.ts @@ -1,6 +1,5 @@ import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { PageContentTypeEnum } from "./requests/contentType" +import type { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType" export type NextSearchParams = { [key: string]: string | string[] | undefined } diff --git a/apps/scandic-web/types/providers/booking-confirmation.ts b/apps/scandic-web/types/providers/booking-confirmation.ts index b72ceacd6..def50797c 100644 --- a/apps/scandic-web/types/providers/booking-confirmation.ts +++ b/apps/scandic-web/types/providers/booking-confirmation.ts @@ -1,5 +1,6 @@ -import type { CurrencyEnum } from "../enums/currency" -import type { RoomCategories } from "../hotel" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import type { RoomCategories } from "@scandic-hotels/trpc/types/hotel" + import type { Room } from "../stores/booking-confirmation" export interface BookingConfirmationProviderProps diff --git a/apps/scandic-web/types/providers/destination-data.ts b/apps/scandic-web/types/providers/destination-data.ts index 0f11ae77d..be349dc3f 100644 --- a/apps/scandic-web/types/providers/destination-data.ts +++ b/apps/scandic-web/types/providers/destination-data.ts @@ -1,9 +1,8 @@ -import type { DestinationPagesHotelData } from "@/types/hotel" -import type { - CategorizedFilters, - SortItem, -} from "../components/destinationFilterAndSort" -import type { DestinationCityListItem } from "../trpc/routers/contentstack/destinationCityPage" +import type { DestinationCityListItem } from "@scandic-hotels/trpc/types/destinationCityPage" +import type { CategorizedFilters } from "@scandic-hotels/trpc/types/destinationFilterAndSort" +import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel" + +import type { SortItem } from "../components/destinationFilterAndSort" export interface DestinationDataProviderProps extends React.PropsWithChildren { allHotels: DestinationPagesHotelData[] diff --git a/apps/scandic-web/types/providers/details/room.ts b/apps/scandic-web/types/providers/details/room.ts index 86977f7a9..0f0df5334 100644 --- a/apps/scandic-web/types/providers/details/room.ts +++ b/apps/scandic-web/types/providers/details/room.ts @@ -1,6 +1,7 @@ +import type { RateEnum } from "@scandic-hotels/trpc/enums/rate" + import type { BedTypeSelection } from "@/types/components/hotelReservation/enterDetails/bedType" import type { RoomRate } from "@/types/components/hotelReservation/enterDetails/details" -import type { RateEnum } from "@/types/enums/rate" import type { Package } from "@/types/requests/packages" export interface Room { diff --git a/apps/scandic-web/types/providers/rates.ts b/apps/scandic-web/types/providers/rates.ts index 59f967a8b..0932bfa0b 100644 --- a/apps/scandic-web/types/providers/rates.ts +++ b/apps/scandic-web/types/providers/rates.ts @@ -1,5 +1,6 @@ -import type { Room } from "@/types/hotel" -import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability" +import type { Room } from "@scandic-hotels/trpc/types/hotel" +import type { RoomsAvailability } from "@scandic-hotels/trpc/types/roomAvailability" + import type { SelectRateBooking } from "../components/hotelReservation/selectRate/selectRate" import type { AvailabilityError } from "../stores/rates" diff --git a/apps/scandic-web/types/requests/asides/contact.ts b/apps/scandic-web/types/requests/asides/contact.ts index b45fb0773..272763321 100644 --- a/apps/scandic-web/types/requests/asides/contact.ts +++ b/apps/scandic-web/types/requests/asides/contact.ts @@ -1,6 +1,6 @@ import type { Lang } from "@scandic-hotels/common/constants/language" +import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges" -import type { EdgesWithTotalCount } from "../utils/edges" import type { Typename } from "../utils/typename" export enum Section { diff --git a/apps/scandic-web/types/requests/blocks/text.ts b/apps/scandic-web/types/requests/blocks/text.ts index 1e713829d..6d6dfe9d5 100644 --- a/apps/scandic-web/types/requests/blocks/text.ts +++ b/apps/scandic-web/types/requests/blocks/text.ts @@ -1,6 +1,7 @@ +import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges" + import type { RTEDocument } from "@/types/rte/node" import type { Embeds } from "../embeds" -import type { EdgesWithTotalCount } from "../utils/edges" export type Text = { text: { diff --git a/apps/scandic-web/types/requests/currentHeader.ts b/apps/scandic-web/types/requests/currentHeader.ts index 10218b347..3c4cea1e0 100644 --- a/apps/scandic-web/types/requests/currentHeader.ts +++ b/apps/scandic-web/types/requests/currentHeader.ts @@ -1,6 +1,7 @@ -import type { Image } from "../image" +import type { Edges } from "@scandic-hotels/trpc/types/edges" +import type { Image } from "@scandic-hotels/trpc/types/image" + import type { AllRequestResponse } from "./utils/all" -import type { Edges } from "./utils/edges" export type CurrentHeaderLink = { href: string diff --git a/apps/scandic-web/types/requests/hero.ts b/apps/scandic-web/types/requests/hero.ts index e89d93d3f..18b537942 100644 --- a/apps/scandic-web/types/requests/hero.ts +++ b/apps/scandic-web/types/requests/hero.ts @@ -1,5 +1,5 @@ -import type { Image } from "../image" -import type { EdgesWithTotalCount } from "./utils/edges" +import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges" +import type { Image } from "@scandic-hotels/trpc/types/image" export type Hero = { imagesConnection: EdgesWithTotalCount diff --git a/apps/scandic-web/types/requests/imageContainer.ts b/apps/scandic-web/types/requests/imageContainer.ts index d6a21185b..595eccccc 100644 --- a/apps/scandic-web/types/requests/imageContainer.ts +++ b/apps/scandic-web/types/requests/imageContainer.ts @@ -1,7 +1,7 @@ -import { EmbedEnum } from "./utils/embeds" +import type { System } from "@scandic-hotels/trpc/routers/contentstack/schemas/system" +import type { ImageVaultAssetResponse } from "@scandic-hotels/trpc/types/imageVault" -import type { ImageVaultAssetResponse } from "../components/imageVault" -import type { System } from "./system" +import type { EmbedEnum } from "./utils/embeds" import type { TypenameInterface } from "./utils/typename" export interface ImageContainer diff --git a/apps/scandic-web/types/requests/packages.ts b/apps/scandic-web/types/requests/packages.ts index e3d48d121..944dcaf84 100644 --- a/apps/scandic-web/types/requests/packages.ts +++ b/apps/scandic-web/types/requests/packages.ts @@ -1,13 +1,12 @@ -import type { z } from "zod" - +import type { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import type { ancillaryPackageInputSchema, breakfastPackageInputSchema, roomPackagesInputSchema, -} from "@/server/routers/hotels/input" -import type { packagesSchema } from "@/server/routers/hotels/output" -import type { RoomPackageCodeEnum } from "../components/hotelReservation/selectRate/roomFilter" -import type { BreakfastPackageEnum } from "../enums/breakfast" +} from "@scandic-hotels/trpc/routers/hotels/input" +import type { packagesSchema } from "@scandic-hotels/trpc/routers/hotels/output" +import type { z } from "zod" export interface BreackfastPackagesInput extends z.input {} diff --git a/apps/scandic-web/types/requests/preamble.ts b/apps/scandic-web/types/requests/preamble.ts index 3f20c808c..ee3b21e18 100644 --- a/apps/scandic-web/types/requests/preamble.ts +++ b/apps/scandic-web/types/requests/preamble.ts @@ -1,6 +1,7 @@ +import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges" + import type { RTEDocument } from "../rte/node" import type { Embeds } from "./embeds" -import type { EdgesWithTotalCount } from "./utils/edges" export type Preamble = { text: { diff --git a/apps/scandic-web/types/requests/puff.ts b/apps/scandic-web/types/requests/puff.ts index 140871d1a..9038687cc 100644 --- a/apps/scandic-web/types/requests/puff.ts +++ b/apps/scandic-web/types/requests/puff.ts @@ -1,6 +1,7 @@ -import type { Image } from "../image" +import type { EdgesWithTotalCount } from "@scandic-hotels/trpc/types/edges" +import type { Image } from "@scandic-hotels/trpc/types/image" + import type { RTEDocument } from "../rte/node" -import type { EdgesWithTotalCount } from "./utils/edges" export enum PuffStyleEnum { button = "button", diff --git a/apps/scandic-web/types/requests/system.ts b/apps/scandic-web/types/requests/system.ts deleted file mode 100644 index 2fb397201..000000000 --- a/apps/scandic-web/types/requests/system.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { z } from "zod" - -import { systemSchema } from "@/server/routers/contentstack/schemas/system" - -export interface System { - system: z.output -} diff --git a/apps/scandic-web/types/requests/utils/asset.ts b/apps/scandic-web/types/requests/utils/asset.ts index 1a200fb8e..cb95d5fa4 100644 --- a/apps/scandic-web/types/requests/utils/asset.ts +++ b/apps/scandic-web/types/requests/utils/asset.ts @@ -1,4 +1,5 @@ -import type { Image } from "@/types/image" +import type { Image } from "@scandic-hotels/trpc/types/image" + import type { EmbedEnum } from "./embeds" import type { TypenameInterface } from "./typename" diff --git a/apps/scandic-web/types/requests/utils/pageLink.ts b/apps/scandic-web/types/requests/utils/pageLink.ts index 48a876529..1278ef309 100644 --- a/apps/scandic-web/types/requests/utils/pageLink.ts +++ b/apps/scandic-web/types/requests/utils/pageLink.ts @@ -3,7 +3,7 @@ import type { z } from "zod" import type { extendedPageLinkSchema, pageLinkSchema, -} from "@/server/routers/contentstack/schemas/pageLinks" +} from "@scandic-hotels/trpc/routers/contentstack/schemas/pageLinks" import type { EmbedEnum } from "./embeds" import type { TypenameInterface } from "./typename" diff --git a/apps/scandic-web/types/requests/utils/refs.ts b/apps/scandic-web/types/requests/utils/refs.ts deleted file mode 100644 index 10d507262..000000000 --- a/apps/scandic-web/types/requests/utils/refs.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { System } from "../system" - -export interface NodeRefs extends System {} diff --git a/apps/scandic-web/types/rte/attrs.ts b/apps/scandic-web/types/rte/attrs.ts index 112edf802..e8767301a 100644 --- a/apps/scandic-web/types/rte/attrs.ts +++ b/apps/scandic-web/types/rte/attrs.ts @@ -1,10 +1,13 @@ import type { Lang } from "@scandic-hotels/common/constants/language" - import type { ImageVaultAsset, ImageVaultAssetResponse, -} from "../components/imageVault" -import type { EmbedTypesEnum, RTEItemType, RTEItemTypeEnum } from "./enums" +} from "@scandic-hotels/trpc/types/imageVault" +import type { + EmbedTypesEnum, + RTEItemType, + RTEItemTypeEnum, +} from "@scandic-hotels/trpc/types/RTEenums" export interface Attributes { [key: string]: any diff --git a/apps/scandic-web/types/rte/node.ts b/apps/scandic-web/types/rte/node.ts index fc1397e0c..d9e13ff65 100644 --- a/apps/scandic-web/types/rte/node.ts +++ b/apps/scandic-web/types/rte/node.ts @@ -1,3 +1,4 @@ +import type { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums" import type { JSX } from "react" import type { EmbedByUid } from "../components/deprecatedjsontohtml" @@ -8,7 +9,6 @@ import type { RTEImageVaultAttrs, RTELinkAttrs, } from "./attrs" -import type { RTETypeEnum } from "./enums" import type { RenderOptions } from "./option" export interface RTEDefaultNode { diff --git a/apps/scandic-web/types/stores/booking-confirmation.ts b/apps/scandic-web/types/stores/booking-confirmation.ts index 382d58873..c7a125bbf 100644 --- a/apps/scandic-web/types/stores/booking-confirmation.ts +++ b/apps/scandic-web/types/stores/booking-confirmation.ts @@ -1,6 +1,7 @@ -import type { ChildBedTypeEnum } from "@/constants/booking" -import type { CurrencyEnum } from "../enums/currency" -import type { RoomCategories } from "../hotel" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import type { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum" +import type { RoomCategories } from "@scandic-hotels/trpc/types/hotel" + import type { BookingConfirmation, PackageSchema, diff --git a/apps/scandic-web/types/stores/destination-data.ts b/apps/scandic-web/types/stores/destination-data.ts index e113af1a7..5ccdcfa36 100644 --- a/apps/scandic-web/types/stores/destination-data.ts +++ b/apps/scandic-web/types/stores/destination-data.ts @@ -1,12 +1,10 @@ +import type { SortOption } from "@scandic-hotels/trpc/enums/destinationFilterAndSort" +import type { DestinationCityListItem } from "@scandic-hotels/trpc/types/destinationCityPage" +import type { CategorizedFilters } from "@scandic-hotels/trpc/types/destinationFilterAndSort" +import type { DestinationPagesHotelData } from "@scandic-hotels/trpc/types/hotel" import type { ReadonlyURLSearchParams } from "next/navigation" -import type { - CategorizedFilters, - SortItem, -} from "../components/destinationFilterAndSort" -import type { SortOption } from "../enums/destinationFilterAndSort" -import type { DestinationPagesHotelData } from "../hotel" -import type { DestinationCityListItem } from "../trpc/routers/contentstack/destinationCityPage" +import type { SortItem } from "../components/destinationFilterAndSort" interface Actions { updateActiveFiltersAndSort: (filters: string[], sort: string | null) => void diff --git a/apps/scandic-web/types/stores/enter-details.ts b/apps/scandic-web/types/stores/enter-details.ts index 79c0f6536..d51899675 100644 --- a/apps/scandic-web/types/stores/enter-details.ts +++ b/apps/scandic-web/types/stores/enter-details.ts @@ -17,7 +17,7 @@ import type { import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" import type { StepEnum } from "@/types/enums/step" import type { Price } from "../components/hotelReservation/price" -import type { CurrencyEnum } from "../enums/currency" +import type { CurrencyEnum } from "../../../../packages/common/constants/currency" import type { Packages } from "../requests/packages" export interface InitialRoomData { diff --git a/apps/scandic-web/types/stores/my-stay.ts b/apps/scandic-web/types/stores/my-stay.ts index 93cbb1157..16dba3ce0 100644 --- a/apps/scandic-web/types/stores/my-stay.ts +++ b/apps/scandic-web/types/stores/my-stay.ts @@ -1,3 +1,8 @@ +import type { + Hotel, + Room as HotelRoom, + RoomCategories, +} from "@scandic-hotels/trpc/types/hotel" import type { IntlShape } from "react-intl" import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast" @@ -6,7 +11,6 @@ import type { RoomPrice } from "@/types/components/hotelReservation/enterDetails import type { PriceTypeEnum } from "@/types/components/hotelReservation/myStay/myStay" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" import type { Packages } from "@/types/components/myPages/myStay/ancillaries" -import type { Hotel, Room as HotelRoom, RoomCategories } from "@/types/hotel" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" import type { CreditCard } from "@/types/user" diff --git a/apps/scandic-web/types/stores/rates.ts b/apps/scandic-web/types/stores/rates.ts index 0622fad63..78ccbf10b 100644 --- a/apps/scandic-web/types/stores/rates.ts +++ b/apps/scandic-web/types/stores/rates.ts @@ -1,17 +1,18 @@ -import type { DefaultFilterOptions } from "@/types/components/hotelReservation/selectRate/roomFilter" +import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import type { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" +import type { Room } from "@scandic-hotels/trpc/types/hotel" +import type { + Product, + RoomConfiguration, + RoomsAvailability, +} from "@scandic-hotels/trpc/types/roomAvailability" + import type { Rate, Room as RoomBooking, SelectRateBooking, } from "@/types/components/hotelReservation/selectRate/selectRate" -import type { CurrencyEnum } from "@/types/enums/currency" -import type { Room } from "@/types/hotel" import type { Package, PackageEnum } from "@/types/requests/packages" -import type { - Product, - RoomConfiguration, - RoomsAvailability, -} from "@/types/trpc/routers/hotel/roomAvailability" import type { BookingCodeFilterEnum } from "../enums/bookingCodeFilter" export interface AvailabilityError { @@ -51,6 +52,11 @@ export interface SelectedRoom { selectedRate: SelectedRate | null } +interface DefaultFilterOptions { + code: RoomPackageCodeEnum + description: string +} + export interface RatesState { activeRoom: number booking: SelectRateBooking diff --git a/apps/scandic-web/types/transitionTypes/jsontohtml.ts b/apps/scandic-web/types/transitionTypes/jsontohtml.ts index ce92c08d8..8683990b0 100644 --- a/apps/scandic-web/types/transitionTypes/jsontohtml.ts +++ b/apps/scandic-web/types/transitionTypes/jsontohtml.ts @@ -1,5 +1,6 @@ -import type { Node } from "@/types/requests/utils/edges" -import type { Embeds } from "@/types/trpc/routers/utils/embeds" +import type { Node } from "@scandic-hotels/trpc/types/edges" +import type { Embeds } from "@scandic-hotels/trpc/types/embeds" + import type { RTENode } from "./rte/node" import type { RenderOptions } from "./rte/option" diff --git a/apps/scandic-web/types/transitionTypes/rte/attrs.ts b/apps/scandic-web/types/transitionTypes/rte/attrs.ts index 8c298912c..e7ab49e6d 100644 --- a/apps/scandic-web/types/transitionTypes/rte/attrs.ts +++ b/apps/scandic-web/types/transitionTypes/rte/attrs.ts @@ -1,6 +1,6 @@ import type { Lang } from "@scandic-hotels/common/constants/language" +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" -import type { ImageVaultAsset } from "../../components/imageVault" import type { EmbedTypesEnum, RTEItemType, RTEItemTypeEnum } from "./enums" export interface Attributes { diff --git a/apps/scandic-web/types/trpc/routers/booking/confirmation.ts b/apps/scandic-web/types/trpc/routers/booking/confirmation.ts index 4b6e6f5eb..e014a6b07 100644 --- a/apps/scandic-web/types/trpc/routers/booking/confirmation.ts +++ b/apps/scandic-web/types/trpc/routers/booking/confirmation.ts @@ -1,6 +1,6 @@ +import type { HotelData, Room } from "@scandic-hotels/trpc/types/hotel" import type { z } from "zod" -import type { HotelData, Room } from "@/types/hotel" import type { bookingConfirmationSchema, packageSchema, diff --git a/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts b/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts index b2f0e4b02..93eadb3db 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts +++ b/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts @@ -1,17 +1,16 @@ +import type { cardGallerySchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardGallery" +import type { teaserCardBlockSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cards/teaserCard" +import type { cardsGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardsGrid" +import type { carouselCardsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/carouselCards" +import type { contentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/content" +import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/dynamicContent" +import type { contentPageHotelListingSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/hotelListing" +import type { shortcutsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/shortcuts" +import type { tableSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/table" +import type { textColsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/textCols" +import type { uspGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/uspGrid" import type { z } from "zod" -import type { cardGallerySchema } from "@/server/routers/contentstack/schemas/blocks/cardGallery" -import type { teaserCardBlockSchema } from "@/server/routers/contentstack/schemas/blocks/cards/teaserCard" -import type { cardsGridSchema } from "@/server/routers/contentstack/schemas/blocks/cardsGrid" -import type { carouselCardsSchema } from "@/server/routers/contentstack/schemas/blocks/carouselCards" -import type { contentSchema } from "@/server/routers/contentstack/schemas/blocks/content" -import type { dynamicContentSchema } from "@/server/routers/contentstack/schemas/blocks/dynamicContent" -import type { contentPageHotelListingSchema } from "@/server/routers/contentstack/schemas/blocks/hotelListing" -import type { shortcutsSchema } from "@/server/routers/contentstack/schemas/blocks/shortcuts" -import type { tableSchema } from "@/server/routers/contentstack/schemas/blocks/table" -import type { textColsSchema } from "@/server/routers/contentstack/schemas/blocks/textCols" -import type { uspGridSchema } from "@/server/routers/contentstack/schemas/blocks/uspGrid" - export interface TeaserCard extends z.output {} export interface CardsGrid extends z.output {} export interface Content extends z.output {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/contentPage.ts b/apps/scandic-web/types/trpc/routers/contentstack/contentPage.ts deleted file mode 100644 index 1ee74c5a6..000000000 --- a/apps/scandic-web/types/trpc/routers/contentstack/contentPage.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { z } from "zod" - -import type { - blocksSchema, - contentPageRefsSchema, - contentPageSchema, - sidebarSchema, -} from "@/server/routers/contentstack/contentPage/output" - -export interface GetContentPageRefsSchema - extends z.input {} - -export interface ContentPageRefs - extends z.output {} - -export interface GetContentPageSchema - extends z.input {} - -export interface ContentPage extends z.output {} - -export type Block = z.output - -export type GetBlock = z.input - -export type SidebarBlock = z.output diff --git a/apps/scandic-web/types/trpc/routers/contentstack/footer.ts b/apps/scandic-web/types/trpc/routers/contentstack/footer.ts index 4baee7f73..0e208f846 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/footer.ts +++ b/apps/scandic-web/types/trpc/routers/contentstack/footer.ts @@ -4,7 +4,7 @@ import type { validateLinkItem, validateLinksWithType, validateSecondaryLinks, -} from "@/server/routers/contentstack/base/output" +} from "@scandic-hotels/trpc/routers/contentstack/base/output" export type FooterLink = z.output export type FooterSecondaryNavGroup = z.output diff --git a/apps/scandic-web/types/trpc/routers/contentstack/metadata.ts b/apps/scandic-web/types/trpc/routers/contentstack/metadata.ts deleted file mode 100644 index ba8150b61..000000000 --- a/apps/scandic-web/types/trpc/routers/contentstack/metadata.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { z } from "zod" - -import type { getMetadataInput } from "@/server/routers/contentstack/metadata/input" -import type { rawMetadataSchema } from "@/server/routers/contentstack/metadata/output" - -export interface RawMetadataSchema extends z.output {} - -export interface MetadataInputSchema extends z.input {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/partner.ts b/apps/scandic-web/types/trpc/routers/contentstack/partner.ts index d67f77329..d0e7f079a 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/partner.ts +++ b/apps/scandic-web/types/trpc/routers/contentstack/partner.ts @@ -1,9 +1,4 @@ +import type { validateSasTierComparisonSchema } from "@scandic-hotels/trpc/routers/contentstack/partner/output" import type { z } from "zod" -import type { validateSasTierComparisonSchema } from "@/server/routers/contentstack/partner/output" - -export type SasTierComparisonResponse = z.input< - typeof validateSasTierComparisonSchema -> - export type SasTierComparison = z.output diff --git a/apps/scandic-web/types/trpc/routers/contentstack/sidebar.ts b/apps/scandic-web/types/trpc/routers/contentstack/sidebar.ts index 813f10d88..5ad46ab56 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/sidebar.ts +++ b/apps/scandic-web/types/trpc/routers/contentstack/sidebar.ts @@ -1,7 +1,7 @@ import type { z } from "zod" -import type { joinLoyaltyContactSidebarSchema } from "@/server/routers/contentstack/loyaltyPage/output" -import type { contactSchema } from "@/server/routers/contentstack/schemas/sidebar/joinLoyaltyContact" +import type { joinLoyaltyContactSidebarSchema } from "@scandic-hotels/trpc/routers/contentstack/loyaltyPage/output" +import type { contactSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/sidebar/joinLoyaltyContact" export interface JoinLoyaltyContact extends z.output {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/startPage.ts b/apps/scandic-web/types/trpc/routers/contentstack/startPage.ts index a1d24bb76..7eb191985 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/startPage.ts +++ b/apps/scandic-web/types/trpc/routers/contentstack/startPage.ts @@ -1,23 +1,7 @@ +import type { fullWidthCampaignSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/fullWidthCampaign" +import type { joinScandicFriendsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/joinScandicFriends" import type { z } from "zod" -import type { fullWidthCampaignSchema } from "@/server/routers/contentstack/schemas/blocks/fullWidthCampaign" -import type { joinScandicFriendsSchema } from "@/server/routers/contentstack/schemas/blocks/joinScandicFriends" -import type { - blocksSchema, - startPageRefsSchema, - startPageSchema, -} from "@/server/routers/contentstack/startPage/output" - -export interface GetStartPageData extends z.input {} -export interface StartPage extends z.output {} - -export interface GetStartPageRefsSchema - extends z.input {} - -export interface StartPageRefs extends z.output {} - -export type Block = z.output - export type FullWidthCampaign = z.output< typeof fullWidthCampaignSchema >["full_width_campaign"] diff --git a/apps/scandic-web/types/trpc/routers/hotel/availability.ts b/apps/scandic-web/types/trpc/routers/hotel/availability.ts index 16b58dd2f..ab16d9cb1 100644 --- a/apps/scandic-web/types/trpc/routers/hotel/availability.ts +++ b/apps/scandic-web/types/trpc/routers/hotel/availability.ts @@ -1,19 +1,18 @@ -import type { z } from "zod" - import type { enterDetailsRoomsAvailabilityInputSchema, getHotelsByHotelIdsAvailabilityInputSchema, hotelsAvailabilityInputSchema, selectRateRoomsAvailabilityInputSchema, -} from "@/server/routers/hotels/input" -import type { hotelsAvailabilitySchema } from "@/server/routers/hotels/output" -import type { productTypeSchema } from "@/server/routers/hotels/schemas/availability/productType" +} from "@scandic-hotels/trpc/routers/hotels/input" +import type { hotelsAvailabilitySchema } from "@scandic-hotels/trpc/routers/hotels/output" +import type { productTypeSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/availability/productType" import type { productTypeCorporateChequeSchema, productTypePointsSchema, productTypePriceSchema, productTypeVoucherSchema, -} from "@/server/routers/hotels/schemas/productTypePrice" +} from "@scandic-hotels/trpc/routers/hotels/schemas/productTypePrice" +import type { z } from "zod" export type HotelsAvailability = z.output export type HotelsAvailabilityInputSchema = z.output< diff --git a/apps/scandic-web/types/trpc/routers/hotel/hotel.ts b/apps/scandic-web/types/trpc/routers/hotel/hotel.ts deleted file mode 100644 index d086488ef..000000000 --- a/apps/scandic-web/types/trpc/routers/hotel/hotel.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { z } from "zod" - -import type { Room } from "@/types/hotel" -import type { - cityCoordinatesInputSchema, - hotelInputSchema, -} from "@/server/routers/hotels/input" - -export type CityCoordinatesInput = z.input -export type HotelInput = z.input - -export type RoomType = Pick diff --git a/apps/scandic-web/types/trpc/routers/utils/embeds.ts b/apps/scandic-web/types/trpc/routers/utils/embeds.ts deleted file mode 100644 index 6c647aea7..000000000 --- a/apps/scandic-web/types/trpc/routers/utils/embeds.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { z } from "zod" - -import type { contentEmbedsSchema } from "@/server/routers/contentstack/schemas/blocks/contentEmbeds" - -export type Embeds = z.output diff --git a/apps/scandic-web/utils/booking.ts b/apps/scandic-web/utils/booking.ts index b4f3f6c34..3214bcab1 100644 --- a/apps/scandic-web/utils/booking.ts +++ b/apps/scandic-web/utils/booking.ts @@ -1,4 +1,4 @@ -import type { Room } from "@/types/hotel" +import type { Room } from "@scandic-hotels/trpc/types/hotel" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" export function getBookedHotelRoom( diff --git a/apps/scandic-web/utils/dateFormatting.ts b/apps/scandic-web/utils/dateFormatting.ts index 4bc260f68..a4e6363aa 100644 --- a/apps/scandic-web/utils/dateFormatting.ts +++ b/apps/scandic-web/utils/dateFormatting.ts @@ -1,4 +1,4 @@ -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/apps/scandic-web/utils/facilityCards.ts b/apps/scandic-web/utils/facilityCards.ts index c2f3b29cc..314bbac0d 100644 --- a/apps/scandic-web/utils/facilityCards.ts +++ b/apps/scandic-web/utils/facilityCards.ts @@ -1,3 +1,12 @@ +import { FacilityEnum } from "@scandic-hotels/trpc/enums/facilities" + +import type { + Amenities, + Facility, + FacilityData, + HealthFacilities, +} from "@scandic-hotels/trpc/types/hotel" + import { type Facilities, type FacilityCard, @@ -14,16 +23,9 @@ import { import { type HotelHashValue, SidepeekSlugs, -} from "@/types/components/hotelPage/hotelPage"; +} from "@/types/components/hotelPage/hotelPage" import type { HotelPageSections } from "@/types/components/hotelPage/sections" -import { FacilityEnum } from "@/types/enums/facilities" import { HotelHashValues } from "@/types/enums/hotelPage" -import type { - Amenities, - Facility, - FacilityData, - HealthFacilities, -} from "@/types/hotel" import type { CardProps } from "@/components/TempDesignSystem/Card/card" export function setFacilityCards( diff --git a/apps/scandic-web/utils/hotelSearchDetails.ts b/apps/scandic-web/utils/hotelSearchDetails.ts index a3c292c30..fb3c9f238 100644 --- a/apps/scandic-web/utils/hotelSearchDetails.ts +++ b/apps/scandic-web/utils/hotelSearchDetails.ts @@ -1,6 +1,11 @@ import { notFound } from "next/navigation" import { safeTry } from "@scandic-hotels/common/utils/safeTry" +import { + type HotelLocation, + isHotelLocation, + type Location, +} from "@scandic-hotels/trpc/types/locations" import { REDEMPTION } from "@/constants/booking" import { getLocations } from "@/lib/trpc/memoizedRequests" @@ -9,11 +14,6 @@ import { generateChildrenString } from "@/components/HotelReservation/utils" import type { BookingSearchType } from "@/types/components/hotelReservation/booking" import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate" -import { - type HotelLocation, - isHotelLocation, - type Location, -} from "@/types/trpc/routers/hotel/locations" export type ChildrenInRoom = (Child[] | null)[] | null export type ChildrenInRoomString = (string | null)[] | null diff --git a/apps/scandic-web/utils/imageGallery.ts b/apps/scandic-web/utils/imageGallery.ts index 9cde28e69..fc285c4fb 100644 --- a/apps/scandic-web/utils/imageGallery.ts +++ b/apps/scandic-web/utils/imageGallery.ts @@ -1,6 +1,6 @@ import type { GalleryImage } from "@/types/components/imageGallery" -import type { ImageVaultAsset } from "@/types/components/imageVault" -import type { ApiImage } from "@/types/hotel" +import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault" +import type { ApiImage } from "@scandic-hotels/trpc/types/hotel" function mapApiImageToGalleryImage(apiImage: ApiImage): GalleryImage { return { diff --git a/apps/scandic-web/utils/jsonSchemas.ts b/apps/scandic-web/utils/jsonSchemas.ts index bd245727e..7aba62d18 100644 --- a/apps/scandic-web/utils/jsonSchemas.ts +++ b/apps/scandic-web/utils/jsonSchemas.ts @@ -7,8 +7,8 @@ import type { WithContext, } from "schema-dts" -import type { HotelData } from "@/types/hotel" -import type { Breadcrumbs } from "@/types/trpc/routers/contentstack/breadcrumbs" +import type { HotelData } from "@scandic-hotels/trpc/types/hotel" +import type { Breadcrumbs } from "@scandic-hotels/trpc/types/breadcrumbs" export function generateBreadcrumbsSchema(breadcrumbs: Breadcrumbs) { const itemListElement: ListItem[] = breadcrumbs.map((item, index) => ({ diff --git a/apps/scandic-web/utils/loyaltyTable.ts b/apps/scandic-web/utils/loyaltyTable.ts index bc6f91a44..5c0549a71 100644 --- a/apps/scandic-web/utils/loyaltyTable.ts +++ b/apps/scandic-web/utils/loyaltyTable.ts @@ -1,5 +1,6 @@ +import type { CMSReward } from "@scandic-hotels/trpc/types/reward" + import type { ComparisonLevel } from "@/types/components/overviewTable" -import type { CMSReward } from "@/types/trpc/routers/contentstack/reward" export function getGroupedRewards(levels: ComparisonLevel[]) { const allRewards = levels diff --git a/apps/scandic-web/utils/membershipLevels.ts b/apps/scandic-web/utils/membershipLevels.ts index 3d08bdf00..2599caf2c 100644 --- a/apps/scandic-web/utils/membershipLevels.ts +++ b/apps/scandic-web/utils/membershipLevels.ts @@ -1,4 +1,4 @@ -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" export function isMembershipLevel(value: string): value is MembershipLevelEnum { return Object.values(MembershipLevelEnum).some((level) => level === value) diff --git a/apps/scandic-web/utils/merge.ts b/apps/scandic-web/utils/merge.ts deleted file mode 100644 index 84aaae145..000000000 --- a/apps/scandic-web/utils/merge.ts +++ /dev/null @@ -1,19 +0,0 @@ -import merge from "deepmerge" - -export function arrayMerge( - target: any[], - source: any[], - options: merge.ArrayMergeOptions -) { - const destination = target.slice() - source.forEach((item, index) => { - if (typeof destination[index] === "undefined") { - destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) - } else if (options?.isMergeableObject(item)) { - destination[index] = merge(target[index], item, options) - } else if (target.indexOf(item) === -1) { - destination.push(item) - } - }) - return destination -} diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCityPage.ts b/apps/scandic-web/utils/metadata/description/destinationCityPage.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCityPage.ts rename to apps/scandic-web/utils/metadata/description/destinationCityPage.ts index ba02a8a9a..b00396d70 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCityPage.ts +++ b/apps/scandic-web/utils/metadata/description/destinationCityPage.ts @@ -2,7 +2,7 @@ import { getIntl } from "@/i18n" import { truncateTextAfterLastPeriod } from "../truncate" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" export async function getDestinationCityPageDescription( data: RawMetadataSchema diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCountryPage.ts b/apps/scandic-web/utils/metadata/description/destinationCountryPage.ts similarity index 93% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCountryPage.ts rename to apps/scandic-web/utils/metadata/description/destinationCountryPage.ts index 79a6889fc..ff6c817e1 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/destinationCountryPage.ts +++ b/apps/scandic-web/utils/metadata/description/destinationCountryPage.ts @@ -2,7 +2,7 @@ import { getIntl } from "@/i18n" import { truncateTextAfterLastPeriod } from "../truncate" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" export async function getDestinationCountryPageDescription( data: RawMetadataSchema diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/hotelPage.ts b/apps/scandic-web/utils/metadata/description/hotelPage.ts similarity index 96% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/description/hotelPage.ts rename to apps/scandic-web/utils/metadata/description/hotelPage.ts index e5d09c869..9ef38c2b2 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/hotelPage.ts +++ b/apps/scandic-web/utils/metadata/description/hotelPage.ts @@ -2,7 +2,7 @@ import { getIntl } from "@/i18n" import { truncateTextAfterLastPeriod } from "../truncate" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" function getSubpageDescription( subpageUrl: string, diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/index.ts b/apps/scandic-web/utils/metadata/description/index.ts similarity index 87% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/description/index.ts rename to apps/scandic-web/utils/metadata/description/index.ts index c8dace28e..67b42a628 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/description/index.ts +++ b/apps/scandic-web/utils/metadata/description/index.ts @@ -1,11 +1,12 @@ +import { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType" +import { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums" + import { truncateTextAfterLastPeriod } from "../truncate" import { getDestinationCityPageDescription } from "./destinationCityPage" import { getDestinationCountryPageDescription } from "./destinationCountryPage" import { getHotelPageDescription } from "./hotelPage" -import { PageContentTypeEnum } from "@/types/requests/contentType" -import { RTETypeEnum } from "@/types/rte/enums" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" export async function getDescription(data: RawMetadataSchema) { const metadata = data.web?.seo_metadata diff --git a/apps/scandic-web/utils/generateMetadata.ts b/apps/scandic-web/utils/metadata/generateMetadata.ts similarity index 68% rename from apps/scandic-web/utils/generateMetadata.ts rename to apps/scandic-web/utils/metadata/generateMetadata.ts index 960f11339..87c18327e 100644 --- a/apps/scandic-web/utils/generateMetadata.ts +++ b/apps/scandic-web/utils/metadata/generateMetadata.ts @@ -1,7 +1,14 @@ +import { type RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" + import { env } from "@/env/server" import { serverClient } from "@/lib/trpc/server" +import { getDescription } from "./description" +import { getImage } from "./image" +import { getTitle } from "./title" + import type { Lang } from "@scandic-hotels/common/constants/language" +import type { Metadata } from "next" import type { AlternateURLs } from "next/dist/lib/metadata/types/alternative-urls-types" import type { @@ -24,13 +31,14 @@ export async function generateMetadata({ // cause duplicate content issues. const noIndexOnSearchParams = !!Object.keys(otherSearchParams).length const caller = await serverClient() - const { metadata, alternates } = await caller.contentstack.metadata.get({ - subpage, - filterFromUrl, - noIndex: noIndexOnSearchParams, - }) + const { rawMetadata, alternates, robots } = + await caller.contentstack.metadata.get({ + subpage, + filterFromUrl, + noIndex: noIndexOnSearchParams, + }) - if (!metadata) { + if (!rawMetadata) { return { robots: { index: env.isLangLive(lang), @@ -39,6 +47,8 @@ export async function generateMetadata({ } } + const metadata = await getTransformedMetadata(rawMetadata, alternates, robots) + if (typeof metadata?.robots === "string") { return metadata } @@ -92,3 +102,30 @@ function getUrl(alternates: AlternateURLs | null): string | null { return null } } + +async function getTransformedMetadata( + data: RawMetadataSchema, + alternates: Metadata["alternates"] | null, + robots: Metadata["robots"] | null = null +) { + const noIndex = !!data.web?.seo_metadata?.noindex + + const metadata: Metadata = { + metadataBase: env.PUBLIC_URL ? new URL(env.PUBLIC_URL) : undefined, + title: await getTitle(data), + description: await getDescription(data), + openGraph: { + images: getImage(data), + }, + alternates, + robots, + } + + if (noIndex) { + metadata.robots = { + index: false, + follow: false, + } + } + return metadata +} diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/image.ts b/apps/scandic-web/utils/metadata/image.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/image.ts rename to apps/scandic-web/utils/metadata/image.ts index 92ded8ff5..82cc93025 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/image.ts +++ b/apps/scandic-web/utils/metadata/image.ts @@ -1,4 +1,4 @@ -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" export function getImage(data: RawMetadataSchema) { const metadataImage = data.web?.seo_metadata?.seo_image diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/title.ts b/apps/scandic-web/utils/metadata/title.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/title.ts rename to apps/scandic-web/utils/metadata/title.ts index 9ebdf8470..cb35bacac 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/title.ts +++ b/apps/scandic-web/utils/metadata/title.ts @@ -1,6 +1,6 @@ import { getIntl } from "@/i18n" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output" export async function getTitle(data: RawMetadataSchema) { const intl = await getIntl() diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/truncate.ts b/apps/scandic-web/utils/metadata/truncate.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/truncate.ts rename to apps/scandic-web/utils/metadata/truncate.ts diff --git a/apps/scandic-web/utils/rewards.ts b/apps/scandic-web/utils/rewards.ts index 3bb170d09..37393a6ed 100644 --- a/apps/scandic-web/utils/rewards.ts +++ b/apps/scandic-web/utils/rewards.ts @@ -1,29 +1,26 @@ -import { RESTAURANT_REWARD_IDS, REWARD_IDS } from "@/constants/rewards" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" +import { getReedemableCoupons } from "@scandic-hotels/trpc/routers/contentstack/reward/helpers" +import { + RESTAURANT_REWARD_IDS, + type RestaurantRewardId, + REWARD_IDS, + type RewardId, +} from "@scandic-hotels/trpc/types/rewards" -import type { Dayjs } from "dayjs" - -import type { - RestaurantRewardId, - RewardId, -} from "@/types/components/myPages/rewards" import type { ApiReward, RedeemableCoupon, RedeemLocation, - SurpriseReward, -} from "@/types/trpc/routers/contentstack/reward" +} from "@scandic-hotels/trpc/types/reward" +import type { Dayjs } from "dayjs" export { getEarliestExpirationDate, getFirstRedeemableCoupon, - getRedeemableRewards, getReedemableCoupons, - getUnwrappedSurpriseRewards, isOnSiteTierReward, isRestaurantOnSiteTierReward, isRestaurantReward, - isSurpriseReward, isTierType, isValidRewardId, redeemLocationIsOnSite, @@ -58,15 +55,6 @@ function isRestaurantOnSiteTierReward(reward: ApiReward): boolean { return isOnSiteTierReward(reward) && isRestaurantReward(reward.rewardId) } -function getReedemableCoupons(reward: ApiReward): RedeemableCoupon[] { - if ("coupon" in reward) { - return reward.coupon.filter( - (coupon): coupon is RedeemableCoupon => coupon.state !== "redeemed" - ) - } - return [] -} - function getFirstRedeemableCoupon(reward: ApiReward): RedeemableCoupon { const sortedCoupons = getReedemableCoupons(reward).sort((a, b) => { // null values used instead of undefined, otherwise it will return current time @@ -88,37 +76,3 @@ function getEarliestExpirationDate(reward: ApiReward) { return earliestDate.isBefore(expiresAtDate) ? earliestDate : expiresAtDate }, null) } - -function isSurpriseReward(reward: ApiReward): reward is SurpriseReward { - return reward.rewardType === "Surprise" -} - -function getUnwrappedSurpriseRewards(rewards: ApiReward[]) { - return rewards - .filter(isSurpriseReward) - .filter((reward) => getReedemableCoupons(reward).length) - .filter((reward) => { - const unwrappedCoupons = - reward.coupon.filter((coupon) => !coupon.unwrapped) || [] - - return unwrappedCoupons.length - }) -} - -function getRedeemableRewards(rewards: ApiReward[]) { - return rewards - .filter((reward) => { - if ("coupon" in reward && reward.coupon.length > 0) { - if (reward.coupon.every((coupon) => coupon.state === "redeemed")) { - return false - } - } - return true - }) - .filter((reward) => { - if (isSurpriseReward(reward)) { - return !reward.coupon.some(({ unwrapped }) => !unwrapped) - } - return true - }) -} diff --git a/apps/scandic-web/utils/specialRoomType.ts b/apps/scandic-web/utils/specialRoomType.ts index 6ff8829ce..62e175401 100644 --- a/apps/scandic-web/utils/specialRoomType.ts +++ b/apps/scandic-web/utils/specialRoomType.ts @@ -1,4 +1,4 @@ -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import type { Packages } from "@/types/requests/packages" import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation" diff --git a/apps/scandic-web/utils/tracking/myStay.ts b/apps/scandic-web/utils/tracking/myStay.ts index 443500c0b..b514fd07d 100644 --- a/apps/scandic-web/utils/tracking/myStay.ts +++ b/apps/scandic-web/utils/tracking/myStay.ts @@ -1,8 +1,9 @@ +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" + import { trackEvent } from "./base" import type { SelectedAncillary } from "@/types/components/myPages/myStay/ancillaries" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { CurrencyEnum } from "@/types/enums/currency" import type { Room } from "@/types/stores/my-stay" import type { PackageSchema } from "@/types/trpc/routers/booking/confirmation" import type { CreditCard } from "@/types/user" diff --git a/apps/scandic-web/utils/url.ts b/apps/scandic-web/utils/url.ts index a5167477c..21388bc3e 100644 --- a/apps/scandic-web/utils/url.ts +++ b/apps/scandic-web/utils/url.ts @@ -1,6 +1,8 @@ import { z } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" +import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" +import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { bookingSearchTypes } from "@/constants/booking" @@ -9,26 +11,12 @@ import { parseSearchParams, serializeSearchParams } from "./searchParams" import type { BookingWidgetSearchData } from "@/types/components/bookingWidget" import type { DetailsBooking } from "@/types/components/hotelReservation/enterDetails/details" import type { SelectHotelBooking } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" import type { Room, SelectRateBooking, } from "@/types/components/hotelReservation/selectRate/selectRate" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" import type { NextSearchParams } from "@/types/params" -export function removeMultipleSlashes(pathname: string) { - return pathname.replaceAll(/\/\/+/g, "/") -} - -export function removeTrailingSlash(pathname: string) { - if (pathname.endsWith("/")) { - // Remove the trailing slash - return pathname.slice(0, -1) - } - return pathname -} - type PartialRoom = { rooms?: Partial[] } export type SelectHotelParams = Omit & { diff --git a/apps/scandic-web/utils/user.ts b/apps/scandic-web/utils/user.ts index 5e1ceb8e6..1ffd87549 100644 --- a/apps/scandic-web/utils/user.ts +++ b/apps/scandic-web/utils/user.ts @@ -1,7 +1,7 @@ import { type MembershipLevel, MembershipLevelEnum, -} from "@/constants/membershipLevels" +} from "@scandic-hotels/common/constants/membershipLevels" import type { EurobonusMembership, diff --git a/apps/scandic-web/types/enums/currency.ts b/packages/common/constants/currency.ts similarity index 84% rename from apps/scandic-web/types/enums/currency.ts rename to packages/common/constants/currency.ts index 490d93ec0..a370f39be 100644 --- a/apps/scandic-web/types/enums/currency.ts +++ b/packages/common/constants/currency.ts @@ -1,3 +1,5 @@ +// TODO move to better location? + export enum CurrencyEnum { DKK = "DKK", EUR = "EUR", diff --git a/packages/common/constants/membershipLevels.ts b/packages/common/constants/membershipLevels.ts new file mode 100644 index 000000000..625b8908b --- /dev/null +++ b/packages/common/constants/membershipLevels.ts @@ -0,0 +1,11 @@ +export enum MembershipLevelEnum { + L1 = "L1", + L2 = "L2", + L3 = "L3", + L4 = "L4", + L5 = "L5", + L6 = "L6", + L7 = "L7", +} + +export type MembershipLevel = keyof typeof MembershipLevelEnum diff --git a/packages/common/constants/paymentMethod.ts b/packages/common/constants/paymentMethod.ts new file mode 100644 index 000000000..123bbcb3a --- /dev/null +++ b/packages/common/constants/paymentMethod.ts @@ -0,0 +1,23 @@ +// TODO move to better location? + +export enum PaymentMethodEnum { + card = "card", + swish = "swish", + vipps = "vipps", + mobilePay = "mobilePay", + applePay = "applePay", + googlePay = "googlePay", + alipayPlus = "alipayPlus", + weChatPay = "weChatPay", + payPal = "payPal", + klarna = "klarna", + americanExpress = "americanExpress", + dankort = "dankort", + dinersClub = "dinersClub", + jcb = "jcb", + masterCard = "masterCard", + visa = "visa", + maestro = "maestro", + chinaUnionPay = "chinaUnionPay", + discover = "discover", +} diff --git a/apps/scandic-web/constants/routes/findMyBooking.js b/packages/common/constants/routes/findMyBooking.ts similarity index 61% rename from apps/scandic-web/constants/routes/findMyBooking.js rename to packages/common/constants/routes/findMyBooking.ts index 904088655..30b9fa04d 100644 --- a/apps/scandic-web/constants/routes/findMyBooking.js +++ b/packages/common/constants/routes/findMyBooking.ts @@ -1,10 +1,6 @@ -/** - * @file Due to these records being used in next.config.js, and that is required - * to be a js file, we use jsdoc to type these. - */ +import type { LangRoute } from "./langRoute" -/** @type {import('@/types/routes').LangRoute} */ -export const findMyBooking = { +export const findMyBooking: LangRoute = { da: "/da/hotelreservation/hent-booking", de: "/de/hotelreservation/mein-bereich", en: "/en/hotelreservation/get-booking", @@ -13,8 +9,7 @@ export const findMyBooking = { sv: "/sv/hotelreservation/hitta-bokning", } -/** @type {import('@/types/routes').LangRoute} */ -export const findMyBookingCurrentWebPath = { +export const findMyBookingCurrentWebPath: LangRoute = { da: "/hotelreservation/hent-booking", de: "/hotelreservation/mein-bereich", en: "/hotelreservation/get-booking", diff --git a/apps/scandic-web/types/routes.ts b/packages/common/constants/routes/langRoute.ts similarity index 100% rename from apps/scandic-web/types/routes.ts rename to packages/common/constants/routes/langRoute.ts diff --git a/apps/scandic-web/constants/routes/myStay.js b/packages/common/constants/routes/myStay.ts similarity index 59% rename from apps/scandic-web/constants/routes/myStay.js rename to packages/common/constants/routes/myStay.ts index 72d7cdd80..7b1a4c737 100644 --- a/apps/scandic-web/constants/routes/myStay.js +++ b/packages/common/constants/routes/myStay.ts @@ -1,10 +1,6 @@ -/** - * @file Due to these records being used in next.config.js, and that is required - * to be a js file, we use jsdoc to type these. - */ +import type { LangRoute } from "@scandic-hotels/common/constants/routes/langRoute" -/** @type {import('@/types/routes').LangRoute} */ -export const myStay = { +export const myStay: LangRoute = { da: "/da/hotelreservation/min-ophold", de: "/de/hotelreservation/meine-aufenthalte", en: "/en/hotelreservation/my-stay", @@ -13,8 +9,7 @@ export const myStay = { sv: "/sv/hotelreservation/min-vistelse", } -/** @type {import('@/types/routes').LangRoute} */ -export const preliminaryReceipt = { +export const preliminaryReceipt: LangRoute = { da: `${myStay.da}/receipt`, de: `${myStay.de}/receipt`, en: `${myStay.en}/receipt`, diff --git a/apps/scandic-web/lib/dt.ts b/packages/common/dt/dt.ts similarity index 100% rename from apps/scandic-web/lib/dt.ts rename to packages/common/dt/dt.ts diff --git a/packages/common/package.json b/packages/common/package.json index 2f4d75092..ffd031d41 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -15,9 +15,20 @@ "./dataCache": "./dataCache/index.ts", "./telemetry": "./telemetry/index.ts", "./tokenManager": "./tokenManager/index.ts", + "./dt": "./dt/dt.ts", "./utils/isEdge": "./utils/isEdge.ts", "./utils/safeTry": "./utils/safeTry.ts", - "./constants/language": "./constants/language.ts" + "./utils/url": "./utils/url.ts", + "./utils/languages": "./utils/languages.ts", + "./utils/chunk": "./utils/chunk.ts", + "./utils/zod/stringValidator": "./utils/zod/stringValidator.ts", + "./utils/zod/numberValidator": "./utils/zod/numberValidator.ts", + "./utils/zod/arrayValidator": "./utils/zod/arrayValidator.ts", + "./constants/language": "./constants/language.ts", + "./constants/membershipLevels": "./constants/membershipLevels.ts", + "./constants/paymentMethod": "./constants/paymentMethod.ts", + "./constants/currency": "./constants/currency.ts", + "./constants/routes/*": "./constants/routes/*.ts" }, "dependencies": { "@opentelemetry/api": "^1.9.0", diff --git a/apps/scandic-web/utils/chunk.test.ts b/packages/common/utils/chunk.test.ts similarity index 92% rename from apps/scandic-web/utils/chunk.test.ts rename to packages/common/utils/chunk.test.ts index b446fe1d2..cd235b675 100644 --- a/apps/scandic-web/utils/chunk.test.ts +++ b/packages/common/utils/chunk.test.ts @@ -1,4 +1,4 @@ -import { describe, expect } from "@jest/globals" +import { describe, expect } from "vitest" import { chunk } from "./chunk" diff --git a/apps/scandic-web/utils/chunk.ts b/packages/common/utils/chunk.ts similarity index 100% rename from apps/scandic-web/utils/chunk.ts rename to packages/common/utils/chunk.ts diff --git a/apps/scandic-web/utils/languages.ts b/packages/common/utils/languages.ts similarity index 66% rename from apps/scandic-web/utils/languages.ts rename to packages/common/utils/languages.ts index ad1e30aca..7515f03e5 100644 --- a/apps/scandic-web/utils/languages.ts +++ b/packages/common/utils/languages.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { Lang } from "@scandic-hotels/common/constants/language" +import { Lang } from "../constants/language" export const languageSchema = z.preprocess( (arg) => (typeof arg === "string" ? arg.toLowerCase() : arg), @@ -19,3 +19,11 @@ export function findLang(pathname: string): Lang | undefined { return isValidLang(langFromPath) ? langFromPath : undefined } + +/** + * Helper function to convert lang string to Lang enum. + */ +export function toLang(lang: string): Lang | undefined { + const lowerCaseLang = lang.toLowerCase() + return Object.values(Lang).find((l) => l === lowerCaseLang) +} diff --git a/packages/common/utils/url.ts b/packages/common/utils/url.ts new file mode 100644 index 000000000..d9be2c491 --- /dev/null +++ b/packages/common/utils/url.ts @@ -0,0 +1,11 @@ +export function removeMultipleSlashes(pathname: string) { + return pathname.replaceAll(/\/\/+/g, "/") +} + +export function removeTrailingSlash(pathname: string) { + if (pathname.endsWith("/")) { + // Remove the trailing slash + return pathname.slice(0, -1) + } + return pathname +} diff --git a/apps/scandic-web/utils/zod/arrayValidator.ts b/packages/common/utils/zod/arrayValidator.ts similarity index 100% rename from apps/scandic-web/utils/zod/arrayValidator.ts rename to packages/common/utils/zod/arrayValidator.ts diff --git a/apps/scandic-web/utils/zod/numberValidator.ts b/packages/common/utils/zod/numberValidator.ts similarity index 100% rename from apps/scandic-web/utils/zod/numberValidator.ts rename to packages/common/utils/zod/numberValidator.ts diff --git a/apps/scandic-web/utils/zod/stringValidator.ts b/packages/common/utils/zod/stringValidator.ts similarity index 100% rename from apps/scandic-web/utils/zod/stringValidator.ts rename to packages/common/utils/zod/stringValidator.ts diff --git a/packages/trpc/env/server.ts b/packages/trpc/env/server.ts index 79a961338..fac7b4d76 100644 --- a/packages/trpc/env/server.ts +++ b/packages/trpc/env/server.ts @@ -1,6 +1,12 @@ import { createEnv } from "@t3-oss/env-nextjs" import { z } from "zod" +/* + * ⚠️ Remember to also add environment variables to the corresponding config in sites that uses this package. ⚠️ + */ + +const TWENTYFOUR_HOURS = 24 * 60 * 60 + export const env = createEnv({ /** * Due to t3-env only checking typeof window === "undefined" @@ -9,10 +15,39 @@ export const env = createEnv({ */ isServer: typeof window === "undefined" || "Deno" in window, server: { + API_BASEURL: z.string(), + CACHE_TIME_HOTELS: z.coerce + .number() + .default(TWENTYFOUR_HOURS) + .transform((val) => + process.env.CMS_ENVIRONMENT === "test" ? 5 * 60 : val + ), NODE_ENV: z.enum(["development", "test", "production"]), + CMS_ACCESS_TOKEN: z.string(), + CMS_BRANCH: z.enum(["development", "production"]), + CMS_URL: z.string(), + CMS_PREVIEW_URL: z.string(), + CMS_PREVIEW_TOKEN: z.string(), + SENTRY_ENVIRONMENT: z.string().default("development"), + PUBLIC_URL: z.string().default(""), + PRINT_QUERY: z + .string() + .refine((s) => s === "true" || s === "false") + .transform((s) => s === "true") + .default("false"), }, emptyStringAsUndefined: true, runtimeEnv: { + API_BASEURL: process.env.API_BASEURL, + CACHE_TIME_HOTELS: process.env.CACHE_TIME_HOTELS, NODE_ENV: process.env.NODE_ENV, + CMS_ACCESS_TOKEN: process.env.CMS_ACCESS_TOKEN, + CMS_BRANCH: process.env.CMS_BRANCH, + CMS_URL: process.env.CMS_URL, + CMS_PREVIEW_URL: process.env.CMS_PREVIEW_URL, + CMS_PREVIEW_TOKEN: process.env.CMS_PREVIEW_TOKEN, + SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT, + PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, + PRINT_QUERY: process.env.PRINT_QUERY, }, }) diff --git a/packages/trpc/global.d.ts b/packages/trpc/global.d.ts index c218bf691..f50285b05 100644 --- a/packages/trpc/global.d.ts +++ b/packages/trpc/global.d.ts @@ -1,5 +1 @@ -import type { DataCache } from "./dataCache/Cache" - -declare global { - var cacheClient: Promise | undefined -} +import "@scandic-hotels/common/global.d.ts" diff --git a/packages/trpc/lib/DUPLICATED/cache.ts b/packages/trpc/lib/DUPLICATED/cache.ts new file mode 100644 index 000000000..2b44dee49 --- /dev/null +++ b/packages/trpc/lib/DUPLICATED/cache.ts @@ -0,0 +1,22 @@ +import stringify from "json-stable-stringify-without-jsonify" +import { cache as reactCache } from "react" + +/** + * Wrapper function to handle caching of memoized requests that recieve objects as args. + * React Cache will use shallow equality of the arguments to determine if there is a cache hit, + * therefore we need to stringify the arguments to ensure that the cache works as expected. + * This function will handle the stingification of the arguments, the caching of the function, + * and the parsing of the arguments back to their original form. + * + * @param fn - The function to memoize + */ +export function cache any>(fn: T) { + const cachedFunction = reactCache((stringifiedParams: string) => { + return fn(...JSON.parse(stringifiedParams)) + }) + + return (...args: Parameters): ReturnType => { + const stringifiedParams = stringify(args) + return cachedFunction(stringifiedParams) + } +} diff --git a/apps/scandic-web/lib/api/endpoints.ts b/packages/trpc/lib/api/endpoints.ts similarity index 100% rename from apps/scandic-web/lib/api/endpoints.ts rename to packages/trpc/lib/api/endpoints.ts diff --git a/apps/scandic-web/lib/api/index.ts b/packages/trpc/lib/api/index.ts similarity index 91% rename from apps/scandic-web/lib/api/index.ts rename to packages/trpc/lib/api/index.ts index ad1ffa26d..ee6e1b043 100644 --- a/apps/scandic-web/lib/api/index.ts +++ b/packages/trpc/lib/api/index.ts @@ -1,16 +1,20 @@ import merge from "deepmerge" import fetchRetry from "fetch-retry" -import { env } from "@/env/server" +import { env } from "../../env/server" -import type { - RequestOptionsWithJSONBody, - RequestOptionsWithOutBody, -} from "@/types/fetch" import type { Endpoint } from "./endpoints" export { endpoints } from "./endpoints" +interface RequestOptionsWithJSONBody + extends Omit { + body?: Record +} + +interface RequestOptionsWithOutBody + extends Omit {} + const defaultOptions: RequestInit = { cache: "no-store", headers: { diff --git a/apps/scandic-web/types/enums/breakfast.ts b/packages/trpc/lib/enums/breakfast.ts similarity index 100% rename from apps/scandic-web/types/enums/breakfast.ts rename to packages/trpc/lib/enums/breakfast.ts diff --git a/apps/scandic-web/types/components/bookingWidget/enums.ts b/packages/trpc/lib/enums/childBedMapEnum.ts similarity index 100% rename from apps/scandic-web/types/components/bookingWidget/enums.ts rename to packages/trpc/lib/enums/childBedMapEnum.ts diff --git a/packages/trpc/lib/enums/childBedTypeEnum.ts b/packages/trpc/lib/enums/childBedTypeEnum.ts new file mode 100644 index 000000000..e22d79ed4 --- /dev/null +++ b/packages/trpc/lib/enums/childBedTypeEnum.ts @@ -0,0 +1,6 @@ +export enum ChildBedTypeEnum { + Crib = "Crib", + ExtraBed = "ExtraBed", + ParentsBed = "ParentsBed", + Unknown = "Unknown", +} diff --git a/apps/scandic-web/types/requests/contentType.ts b/packages/trpc/lib/enums/contentType.ts similarity index 100% rename from apps/scandic-web/types/requests/contentType.ts rename to packages/trpc/lib/enums/contentType.ts diff --git a/apps/scandic-web/types/enums/destinationFilterAndSort.ts b/packages/trpc/lib/enums/destinationFilterAndSort.ts similarity index 100% rename from apps/scandic-web/types/enums/destinationFilterAndSort.ts rename to packages/trpc/lib/enums/destinationFilterAndSort.ts diff --git a/apps/scandic-web/types/enums/facilities.ts b/packages/trpc/lib/enums/facilities.ts similarity index 100% rename from apps/scandic-web/types/enums/facilities.ts rename to packages/trpc/lib/enums/facilities.ts diff --git a/apps/scandic-web/types/enums/hotelType.ts b/packages/trpc/lib/enums/hotelType.ts similarity index 100% rename from apps/scandic-web/types/enums/hotelType.ts rename to packages/trpc/lib/enums/hotelType.ts diff --git a/apps/scandic-web/types/enums/loyaltyPage.ts b/packages/trpc/lib/enums/loyaltyPage.ts similarity index 100% rename from apps/scandic-web/types/enums/loyaltyPage.ts rename to packages/trpc/lib/enums/loyaltyPage.ts diff --git a/apps/scandic-web/types/enums/packages.ts b/packages/trpc/lib/enums/packages.ts similarity index 100% rename from apps/scandic-web/types/enums/packages.ts rename to packages/trpc/lib/enums/packages.ts diff --git a/apps/scandic-web/types/enums/pointOfInterest.ts b/packages/trpc/lib/enums/pointOfInterest.ts similarity index 100% rename from apps/scandic-web/types/enums/pointOfInterest.ts rename to packages/trpc/lib/enums/pointOfInterest.ts diff --git a/apps/scandic-web/types/enums/rate.ts b/packages/trpc/lib/enums/rate.ts similarity index 100% rename from apps/scandic-web/types/enums/rate.ts rename to packages/trpc/lib/enums/rate.ts diff --git a/apps/scandic-web/types/enums/rateType.ts b/packages/trpc/lib/enums/rateType.ts similarity index 100% rename from apps/scandic-web/types/enums/rateType.ts rename to packages/trpc/lib/enums/rateType.ts diff --git a/packages/trpc/lib/enums/roomFilter.ts b/packages/trpc/lib/enums/roomFilter.ts new file mode 100644 index 000000000..654a8e233 --- /dev/null +++ b/packages/trpc/lib/enums/roomFilter.ts @@ -0,0 +1,5 @@ +export enum RoomPackageCodeEnum { + PET_ROOM = "PETR", + ALLERGY_ROOM = "ALLG", + ACCESSIBILITY_ROOM = "ACCE", +} diff --git a/packages/trpc/lib/enums/scriptedCard.ts b/packages/trpc/lib/enums/scriptedCard.ts new file mode 100644 index 000000000..658a84621 --- /dev/null +++ b/packages/trpc/lib/enums/scriptedCard.ts @@ -0,0 +1,9 @@ +export enum scriptedCardThemeEnum { + one = "one", + two = "two", + three = "three", + primaryDim = "primaryDim", + primaryDark = "primaryDark", + primaryInverted = "primaryInverted", + primaryStrong = "primaryStrong", +} diff --git a/packages/trpc/lib/enums/selectHotel.ts b/packages/trpc/lib/enums/selectHotel.ts new file mode 100644 index 000000000..d4c40ac56 --- /dev/null +++ b/packages/trpc/lib/enums/selectHotel.ts @@ -0,0 +1,4 @@ +export enum AvailabilityEnum { + Available = "Available", + NotAvailable = "NotAvailable", +} diff --git a/apps/scandic-web/lib/graphql/Fragments/AccountPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/AccountPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Alert.graphql b/packages/trpc/lib/graphql/Fragments/Alert.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Alert.graphql rename to packages/trpc/lib/graphql/Fragments/Alert.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Aside/Contact.graphql b/packages/trpc/lib/graphql/Fragments/Aside/Contact.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Aside/Contact.graphql rename to packages/trpc/lib/graphql/Fragments/Aside/Contact.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Aside/Puff.graphql b/packages/trpc/lib/graphql/Fragments/Aside/Puff.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Aside/Puff.graphql rename to packages/trpc/lib/graphql/Fragments/Aside/Puff.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Card.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Card.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Card.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Card.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/CardGallery.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/CardGallery.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/CardsGrid.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/CardsGrid.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/CarouselCards.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/CarouselCards.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Content.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Content.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/ContentCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/ContentCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/DynamicContent.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/DynamicContent.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Essentials.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Essentials.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Essentials.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Essentials.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/HotelListing.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/HotelListing.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/HotelListing.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/HotelListing.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/InfoCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/InfoCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/InfoCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/InfoCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/List.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/List.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/List.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/List.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/LoyaltyCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/LoyaltyCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/LoyaltyCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/LoyaltyCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Puff.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Puff.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Puff.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Puff.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/Card.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/Card.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Shortcuts.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Shortcuts.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Table.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Table.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Table.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Table.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/TeaserCard.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/TeaserCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/TeaserCard.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/TeaserCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Text.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/Text.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/Text.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/Text.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/TextCols.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/TextCols.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/TextContent.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/TextContent.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/TextContent.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/TextContent.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/UspGrid.graphql b/packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Blocks/UspGrid.graphql rename to packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CurrentBlocksPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CurrentBlocksPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/CurrentBlocksPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/CurrentBlocksPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql rename to packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignPage/Hero.graphql b/packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignPage/Hero.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignPage/IncludedHotels.graphql b/packages/trpc/lib/graphql/Fragments/CampaignPage/IncludedHotels.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignPage/IncludedHotels.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignPage/IncludedHotels.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CampaignPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CampaignPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql b/packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CollectionPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CollectionPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql b/packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql rename to packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Contact.graphql b/packages/trpc/lib/graphql/Fragments/Contact.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Contact.graphql rename to packages/trpc/lib/graphql/Fragments/Contact.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql b/packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql rename to packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/ContentPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/ContentPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql b/packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql rename to packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/AppDownloads.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/AppDownloads.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/AppDownloads.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/AppDownloads.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Logo.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/Logo.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Logo.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/Logo.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/MainLinks.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/MainLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/MainLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/MainLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Navigation.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/Navigation.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Navigation.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/Navigation.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Refs/MainLinks.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/Refs/MainLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Refs/MainLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/Refs/MainLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Refs/SecondaryLinks.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/Refs/SecondaryLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/Refs/SecondaryLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/Refs/SecondaryLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/SecondaryLinks.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/SecondaryLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/SecondaryLinks.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/SecondaryLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/SocialMedia.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/SocialMedia.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/SocialMedia.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/SocialMedia.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/CurrentFooter/TripAdvisor.graphql b/packages/trpc/lib/graphql/Fragments/CurrentFooter/TripAdvisor.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/CurrentFooter/TripAdvisor.graphql rename to packages/trpc/lib/graphql/Fragments/CurrentFooter/TripAdvisor.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/DestinationCityPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/DestinationCityPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Footer/AppDownloads.graphql b/packages/trpc/lib/graphql/Fragments/Footer/AppDownloads.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Footer/AppDownloads.graphql rename to packages/trpc/lib/graphql/Fragments/Footer/AppDownloads.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Footer/Refs/TertiaryLinks.graphql b/packages/trpc/lib/graphql/Fragments/Footer/Refs/TertiaryLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Footer/Refs/TertiaryLinks.graphql rename to packages/trpc/lib/graphql/Fragments/Footer/Refs/TertiaryLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Footer/SocialMedia.graphql b/packages/trpc/lib/graphql/Fragments/Footer/SocialMedia.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Footer/SocialMedia.graphql rename to packages/trpc/lib/graphql/Fragments/Footer/SocialMedia.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Grid.graphql b/packages/trpc/lib/graphql/Fragments/Grid.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Grid.graphql rename to packages/trpc/lib/graphql/Fragments/Grid.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Hero.graphql b/packages/trpc/lib/graphql/Fragments/Hero.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Hero.graphql rename to packages/trpc/lib/graphql/Fragments/Hero.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/HotelPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/HotelPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/HotelPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/HotelPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/ImageContainer.graphql b/packages/trpc/lib/graphql/Fragments/ImageContainer.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/ImageContainer.graphql rename to packages/trpc/lib/graphql/Fragments/ImageContainer.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/LoyaltyPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/LoyaltyPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Metadata.graphql b/packages/trpc/lib/graphql/Fragments/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Metadata.graphql rename to packages/trpc/lib/graphql/Fragments/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/AccountPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/AccountPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/AccountPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/AccountPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/CampaignOverviewPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/CampaignOverviewPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/CampaignOverviewPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/CampaignOverviewPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/CampaignPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/CampaignPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/CampaignPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/CampaignPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/CollectionPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/CollectionPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/CollectionPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/CollectionPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/ContentPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/ContentPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/ContentPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/ContentPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/CurrentBlocksPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/CurrentBlocksPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/CurrentBlocksPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/CurrentBlocksPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/CurrentContentPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/CurrentContentPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/CurrentContentPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/CurrentContentPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationCityPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/DestinationCityPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationCityPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/DestinationCityPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationCountryPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/DestinationCountryPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationCountryPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/DestinationCountryPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationOverviewPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/DestinationOverviewPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/DestinationOverviewPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/DestinationOverviewPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/HotelPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/HotelPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/HotelPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/HotelPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/LoyaltyPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/LoyaltyPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/LoyaltyPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/LoyaltyPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageLink/StartPageLink.graphql b/packages/trpc/lib/graphql/Fragments/PageLink/StartPageLink.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageLink/StartPageLink.graphql rename to packages/trpc/lib/graphql/Fragments/PageLink/StartPageLink.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/PageSettings.graphql b/packages/trpc/lib/graphql/Fragments/PageSettings.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/PageSettings.graphql rename to packages/trpc/lib/graphql/Fragments/PageSettings.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Preamble.graphql b/packages/trpc/lib/graphql/Fragments/Preamble.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Preamble.graphql rename to packages/trpc/lib/graphql/Fragments/Preamble.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Puff.graphql b/packages/trpc/lib/graphql/Fragments/Puff.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Puff.graphql rename to packages/trpc/lib/graphql/Fragments/Puff.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/Content.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/Content.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/DynamicContent.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/DynamicContent.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/DynamicContent.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/DynamicContent.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/QuickLinks.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/QuickLinks.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/Sidebar/TeaserCard.graphql b/packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/Sidebar/TeaserCard.graphql rename to packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/StartPage/Ref.graphql b/packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/StartPage/Ref.graphql rename to packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/SysAsset.graphql b/packages/trpc/lib/graphql/Fragments/SysAsset.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/SysAsset.graphql rename to packages/trpc/lib/graphql/Fragments/SysAsset.graphql diff --git a/apps/scandic-web/lib/graphql/Fragments/System.graphql b/packages/trpc/lib/graphql/Fragments/System.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Fragments/System.graphql rename to packages/trpc/lib/graphql/Fragments/System.graphql diff --git a/apps/scandic-web/lib/graphql/Query/AccountPage/AccountPage.graphql b/packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/AccountPage/AccountPage.graphql rename to packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/AccountPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/AccountPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/AccountPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/AccountPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/AccountPage/Navigation.graphql b/packages/trpc/lib/graphql/Query/AccountPage/Navigation.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/AccountPage/Navigation.graphql rename to packages/trpc/lib/graphql/Query/AccountPage/Navigation.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/AccountPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/AccountPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/ContentPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/ContentPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/HotelPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/HotelPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql b/packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql rename to packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql b/packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql rename to packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CampaignOverviewPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/CampaignOverviewPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CampaignOverviewPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/CampaignOverviewPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CampaignPage/CampaignPage.graphql b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CampaignPage/CampaignPage.graphql rename to packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CampaignPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/CampaignPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CampaignPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/CampaignPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CollectionPage/CollectionPage.graphql b/packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CollectionPage/CollectionPage.graphql rename to packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/CollectionPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/CollectionPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/CollectionPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/CollectionPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/ContactConfig.graphql b/packages/trpc/lib/graphql/Query/ContactConfig.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/ContactConfig.graphql rename to packages/trpc/lib/graphql/Query/ContactConfig.graphql diff --git a/apps/scandic-web/lib/graphql/Query/ContentPage/ContentPage.graphql b/packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/ContentPage/ContentPage.graphql rename to packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/ContentPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/ContentPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/ContentPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/ContentPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Current/CurrentBlockPage.graphql b/packages/trpc/lib/graphql/Query/Current/CurrentBlockPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Current/CurrentBlockPage.graphql rename to packages/trpc/lib/graphql/Query/Current/CurrentBlockPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql b/packages/trpc/lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql rename to packages/trpc/lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Current/Footer.graphql b/packages/trpc/lib/graphql/Query/Current/Footer.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Current/Footer.graphql rename to packages/trpc/lib/graphql/Query/Current/Footer.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Current/Header.graphql b/packages/trpc/lib/graphql/Query/Current/Header.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Current/Header.graphql rename to packages/trpc/lib/graphql/Query/Current/Header.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Current/LanguageSwitcher.graphql b/packages/trpc/lib/graphql/Query/Current/LanguageSwitcher.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Current/LanguageSwitcher.graphql rename to packages/trpc/lib/graphql/Query/Current/LanguageSwitcher.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql rename to packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql rename to packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql rename to packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql rename to packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCityPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/DestinationCityPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCityPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/DestinationCityPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql b/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql rename to packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql b/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql rename to packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationCountryPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/DestinationCountryPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationCountryPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/DestinationCountryPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql b/packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql rename to packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Footer.graphql b/packages/trpc/lib/graphql/Query/Footer.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Footer.graphql rename to packages/trpc/lib/graphql/Query/Footer.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Header.graphql b/packages/trpc/lib/graphql/Query/Header.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Header.graphql rename to packages/trpc/lib/graphql/Query/Header.graphql diff --git a/apps/scandic-web/lib/graphql/Query/HotelPage/HotelPage.graphql b/packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/HotelPage/HotelPage.graphql rename to packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/HotelPage/HotelPageCount.graphql b/packages/trpc/lib/graphql/Query/HotelPage/HotelPageCount.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/HotelPage/HotelPageCount.graphql rename to packages/trpc/lib/graphql/Query/HotelPage/HotelPageCount.graphql diff --git a/apps/scandic-web/lib/graphql/Query/HotelPage/HotelPageUrl.graphql b/packages/trpc/lib/graphql/Query/HotelPage/HotelPageUrl.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/HotelPage/HotelPageUrl.graphql rename to packages/trpc/lib/graphql/Query/HotelPage/HotelPageUrl.graphql diff --git a/apps/scandic-web/lib/graphql/Query/HotelPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/HotelPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/HotelPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/HotelPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/LoyaltyLevels.graphql b/packages/trpc/lib/graphql/Query/LoyaltyLevels.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/LoyaltyLevels.graphql rename to packages/trpc/lib/graphql/Query/LoyaltyLevels.graphql diff --git a/apps/scandic-web/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql b/packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql rename to packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql diff --git a/apps/scandic-web/lib/graphql/Query/LoyaltyPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/LoyaltyPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/LoyaltyPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/LoyaltyPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/PageSettings.graphql b/packages/trpc/lib/graphql/Query/PageSettings.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/PageSettings.graphql rename to packages/trpc/lib/graphql/Query/PageSettings.graphql diff --git a/apps/scandic-web/lib/graphql/Query/ResolveEntry.graphql b/packages/trpc/lib/graphql/Query/ResolveEntry.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/ResolveEntry.graphql rename to packages/trpc/lib/graphql/Query/ResolveEntry.graphql diff --git a/apps/scandic-web/lib/graphql/Query/Rewards.graphql b/packages/trpc/lib/graphql/Query/Rewards.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/Rewards.graphql rename to packages/trpc/lib/graphql/Query/Rewards.graphql diff --git a/apps/scandic-web/lib/graphql/Query/RewardsWithRedeem.graphql b/packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/RewardsWithRedeem.graphql rename to packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql diff --git a/apps/scandic-web/lib/graphql/Query/SASTierComparison.graphql b/packages/trpc/lib/graphql/Query/SASTierComparison.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/SASTierComparison.graphql rename to packages/trpc/lib/graphql/Query/SASTierComparison.graphql diff --git a/apps/scandic-web/lib/graphql/Query/SiteConfig.graphql b/packages/trpc/lib/graphql/Query/SiteConfig.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/SiteConfig.graphql rename to packages/trpc/lib/graphql/Query/SiteConfig.graphql diff --git a/apps/scandic-web/lib/graphql/Query/StartPage/Metadata.graphql b/packages/trpc/lib/graphql/Query/StartPage/Metadata.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/StartPage/Metadata.graphql rename to packages/trpc/lib/graphql/Query/StartPage/Metadata.graphql diff --git a/apps/scandic-web/lib/graphql/Query/StartPage/StartPage.graphql b/packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql similarity index 100% rename from apps/scandic-web/lib/graphql/Query/StartPage/StartPage.graphql rename to packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql diff --git a/apps/scandic-web/lib/graphql/_request.ts b/packages/trpc/lib/graphql/_request.ts similarity index 97% rename from apps/scandic-web/lib/graphql/_request.ts rename to packages/trpc/lib/graphql/_request.ts index a31e79fc7..ebc1bd945 100644 --- a/apps/scandic-web/lib/graphql/_request.ts +++ b/packages/trpc/lib/graphql/_request.ts @@ -4,11 +4,11 @@ import { ClientError, type GraphQLClient } from "graphql-request" import { Lang } from "@scandic-hotels/common/constants/language" -import { env } from "@/env/server" +import { env } from "../../env/server" import type { DocumentNode } from "graphql" -import type { Data } from "@/types/request" +import type { Data } from "../types/requestData" export async function request( client: GraphQLClient, diff --git a/apps/scandic-web/lib/graphql/batchRequest.ts b/packages/trpc/lib/graphql/batchRequest.ts similarity index 65% rename from apps/scandic-web/lib/graphql/batchRequest.ts rename to packages/trpc/lib/graphql/batchRequest.ts index c47386bca..5daf5a7ff 100644 --- a/apps/scandic-web/lib/graphql/batchRequest.ts +++ b/packages/trpc/lib/graphql/batchRequest.ts @@ -1,15 +1,14 @@ import "server-only" import deepmerge from "deepmerge" - -import { arrayMerge } from "@/utils/merge" +import merge from "deepmerge" import { request } from "./request" import type { CacheTime } from "@scandic-hotels/common/dataCache" import type { BatchRequestDocument } from "graphql-request" -import type { Data } from "@/types/request" +import type { Data } from "../types/requestData" export async function batchRequest( queries: (BatchRequestDocument & { @@ -49,3 +48,21 @@ export async function batchRequest( throw new Error("Something went wrong") } } + +function arrayMerge( + target: any[], + source: any[], + options: merge.ArrayMergeOptions +) { + const destination = target.slice() + source.forEach((item, index) => { + if (typeof destination[index] === "undefined") { + destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) + } else if (options?.isMergeableObject(item)) { + destination[index] = merge(target[index], item, options) + } else if (target.indexOf(item) === -1) { + destination.push(item) + } + }) + return destination +} diff --git a/apps/scandic-web/lib/graphql/getOperationName.ts b/packages/trpc/lib/graphql/getOperationName.ts similarity index 100% rename from apps/scandic-web/lib/graphql/getOperationName.ts rename to packages/trpc/lib/graphql/getOperationName.ts diff --git a/apps/scandic-web/lib/graphql/request.ts b/packages/trpc/lib/graphql/request.ts similarity index 90% rename from apps/scandic-web/lib/graphql/request.ts rename to packages/trpc/lib/graphql/request.ts index 569182932..bc2536437 100644 --- a/apps/scandic-web/lib/graphql/request.ts +++ b/packages/trpc/lib/graphql/request.ts @@ -8,15 +8,14 @@ import { getCacheClient, } from "@scandic-hotels/common/dataCache" -import { env } from "@/env/server" -import { getPreviewHash, isPreviewByUid } from "@/lib/previewContext" - +import { env } from "../../env/server" +import { getPreviewHash, isPreviewByUid } from "../previewContext" import { request as _request } from "./_request" import { getOperationName } from "./getOperationName" import type { DocumentNode } from "graphql" -import type { Data } from "@/types/request" +import type { Data } from "../types/requestData" export async function request( query: string | DocumentNode, @@ -30,7 +29,8 @@ export async function request( ? isPreviewByUid(variables.uid) : false - const doCall = () => internalRequest(query, shouldUsePreview, variables) + const doCall = () => + internalRequest(query, shouldUsePreview, variables, getPreviewHash()) if (!cacheOptions) { console.warn("[NO CACHE] for query", query) @@ -64,9 +64,9 @@ export async function request( function internalRequest( query: string | DocumentNode, shouldUsePreview: boolean, - variables?: Record + variables?: Record, + previewHash?: string ): Promise> { - const previewHash = getPreviewHash() const cmsUrl = shouldUsePreview ? env.CMS_PREVIEW_URL : env.CMS_URL // Creating a new client for each request to avoid conflicting parameters diff --git a/apps/scandic-web/lib/previewContext.ts b/packages/trpc/lib/previewContext.ts similarity index 100% rename from apps/scandic-web/lib/previewContext.ts rename to packages/trpc/lib/previewContext.ts diff --git a/apps/scandic-web/server/routers/contentstack/accountPage/index.ts b/packages/trpc/lib/routers/contentstack/accountPage/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/accountPage/index.ts rename to packages/trpc/lib/routers/contentstack/accountPage/index.ts index d2e6fe5f8..e57952297 100644 --- a/apps/scandic-web/server/routers/contentstack/accountPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { accountPageQueryRouter } from "./query" export const accountPageRouter = mergeRouters(accountPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/accountPage/output.ts b/packages/trpc/lib/routers/contentstack/accountPage/output.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/accountPage/output.ts rename to packages/trpc/lib/routers/contentstack/accountPage/output.ts index d4fa14f05..663be1ec2 100644 --- a/apps/scandic-web/server/routers/contentstack/accountPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { AccountPageEnum } from "../../../types/accountPageEnum" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { dynamicContentRefsSchema, dynamicContentSchema, @@ -14,8 +14,6 @@ import { textContentSchema } from "../schemas/blocks/textContent" import { tempImageVaultAssetSchema } from "../schemas/imageVault" import { systemSchema } from "../schemas/system" -import { AccountPageEnum } from "@/types/enums/accountPage" - const accountPageDynamicContent = z .object({ __typename: z.literal(AccountPageEnum.ContentStack.blocks.DynamicContent), diff --git a/apps/scandic-web/server/routers/contentstack/accountPage/query.ts b/packages/trpc/lib/routers/contentstack/accountPage/query.ts similarity index 87% rename from apps/scandic-web/server/routers/contentstack/accountPage/query.ts rename to packages/trpc/lib/routers/contentstack/accountPage/query.ts index e581ae80d..644414ca1 100644 --- a/apps/scandic-web/server/routers/contentstack/accountPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/query.ts @@ -1,31 +1,26 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetAccountPage, GetAccountPageRefs, -} from "@/lib/graphql/Query/AccountPage/AccountPage.graphql" -import { request } from "@/lib/graphql/request" - +} from "../../../graphql/Query/AccountPage/AccountPage.graphql" +import { request } from "../../../graphql/request" import { generateRefsResponseTag, generateTag, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { accountPageRefsSchema, accountPageSchema } from "./output" import { getConnections } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" import type { GetAccountPageRefsSchema, GetAccountPageSchema, -} from "@/types/trpc/routers/contentstack/accountPage" +} from "../../../types/accountPage" +import type { TrackingPageData } from "../../types" export const accountPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -111,12 +106,12 @@ export const accountPageQueryRouter = router({ .replaceAll(" ", "") .toLowerCase() - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: validatedAccountPage.data.account_page.system.uid, domainLanguage: lang, publishDate: validatedAccountPage.data.account_page.system.updated_at, createDate: validatedAccountPage.data.account_page.system.created_at, - channel: TrackingChannelEnum["scandic-friends"], + channel: "scandic-friends", pageType: `member${parsedtitle}page`, pageName: validatedAccountPage.data.trackingProps.url, siteSections: validatedAccountPage.data.trackingProps.url, diff --git a/apps/scandic-web/server/routers/contentstack/accountPage/utils.ts b/packages/trpc/lib/routers/contentstack/accountPage/utils.ts similarity index 77% rename from apps/scandic-web/server/routers/contentstack/accountPage/utils.ts rename to packages/trpc/lib/routers/contentstack/accountPage/utils.ts index 44a8cb76d..64c64fc2f 100644 --- a/apps/scandic-web/server/routers/contentstack/accountPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/utils.ts @@ -1,6 +1,7 @@ -import { AccountPageEnum } from "@/types/enums/accountPage" -import type { System } from "@/types/requests/system" -import type { AccountPageRefs } from "@/types/trpc/routers/contentstack/accountPage" +import { AccountPageEnum } from "../../../types/accountPageEnum" + +import type { AccountPageRefs } from "../../../types/accountPage" +import type { System } from "../schemas/system" export function getConnections({ account_page }: AccountPageRefs) { const connections: System["system"][] = [account_page.system] diff --git a/apps/scandic-web/server/routers/contentstack/base/index.ts b/packages/trpc/lib/routers/contentstack/base/index.ts similarity index 65% rename from apps/scandic-web/server/routers/contentstack/base/index.ts rename to packages/trpc/lib/routers/contentstack/base/index.ts index cd510d61e..e95deb4a5 100644 --- a/apps/scandic-web/server/routers/contentstack/base/index.ts +++ b/packages/trpc/lib/routers/contentstack/base/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { baseQueryRouter } from "./query" export const baseRouter = mergeRouters(baseQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/base/output.ts b/packages/trpc/lib/routers/contentstack/base/output.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/base/output.ts rename to packages/trpc/lib/routers/contentstack/base/output.ts index d5cfe38db..19b4943c1 100644 --- a/apps/scandic-web/server/routers/contentstack/base/output.ts +++ b/packages/trpc/lib/routers/contentstack/base/output.ts @@ -1,28 +1,25 @@ import { z, ZodError, ZodIssueCode } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" -import { discriminatedUnion } from "@/lib/discriminatedUnion" +import { AlertTypeEnum } from "../../../types/alertType" +import { discriminatedUnion } from "../../../utils/discriminatedUnion" import { cardBlockRefsSchema, cardBlockSchema, transformCardBlock, transformCardBlockRefs, -} from "@/server/routers/contentstack/schemas/blocks/cardsGrid" +} from "../schemas/blocks/cardsGrid" import { linkRefsUnionSchema, linkUnionSchema, transformPageLink, transformPageLinkRef, -} from "@/server/routers/contentstack/schemas/pageLinks" - -import { IconName } from "@/components/Icons/iconName" -import { removeMultipleSlashes } from "@/utils/url" - +} from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" -import { AlertTypeEnum } from "@/types/enums/alert" -import type { Image } from "@/types/image" +import type { Image } from "../../../types/image" // Help me write this zod schema based on the type ContactConfig export const validateContactConfigSchema = z.object({ @@ -643,6 +640,13 @@ export const menuItemSchema = z } }) +// TODO When original IconName enum is moved to common we should use it +enum IconName { + Gift = "Gift", + InfoCircle = "InfoCircle", + PriceTag = "PriceTag", +} + const topLinkItemSchema = z.intersection( linkAndTitleSchema, z.object({ diff --git a/apps/scandic-web/server/routers/contentstack/base/query.ts b/packages/trpc/lib/routers/contentstack/base/query.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/base/query.ts rename to packages/trpc/lib/routers/contentstack/base/query.ts index e9c594f88..638d366d7 100644 --- a/apps/scandic-web/server/routers/contentstack/base/query.ts +++ b/packages/trpc/lib/routers/contentstack/base/query.ts @@ -1,35 +1,34 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" -import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql" +import { router } from "../../.." +import { GetContactConfig } from "../../../graphql/Query/ContactConfig.graphql" import { GetCurrentFooter, GetCurrentFooterRef, -} from "@/lib/graphql/Query/Current/Footer.graphql" +} from "../../../graphql/Query/Current/Footer.graphql" import { GetCurrentHeader, GetCurrentHeaderRef, -} from "@/lib/graphql/Query/Current/Header.graphql" -import { GetFooter, GetFooterRef } from "@/lib/graphql/Query/Footer.graphql" -import { GetHeader, GetHeaderRef } from "@/lib/graphql/Query/Header.graphql" +} from "../../../graphql/Query/Current/Header.graphql" +import { GetFooter, GetFooterRef } from "../../../graphql/Query/Footer.graphql" +import { GetHeader, GetHeaderRef } from "../../../graphql/Query/Header.graphql" import { GetSiteConfig, GetSiteConfigRef, -} from "@/lib/graphql/Query/SiteConfig.graphql" -import { request } from "@/lib/graphql/request" -import { langInput } from "@/server/utils" - +} from "../../../graphql/Query/SiteConfig.graphql" +// import { router } from "../../.." +import { request } from "../../../graphql/request" +import { langInput } from "../../../utils" import { generateRefsResponseTag, generateTag, generateTags, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { type ContactConfigData, type CurrentFooterDataRaw, @@ -55,18 +54,15 @@ import { import type { Lang } from "@scandic-hotels/common/constants/language" -import type { - FooterDataRaw, - FooterRefDataRaw, -} from "@/types/components/footer/footer" +import type { FooterDataRaw, FooterRefDataRaw } from "../../../types/footer" import type { GetHeader as GetHeaderData, GetHeaderRefs, -} from "@/types/trpc/routers/contentstack/header" +} from "../../../types/header" import type { GetSiteConfigData, GetSiteConfigRefData, -} from "@/types/trpc/routers/contentstack/siteConfig" +} from "../../../types/siteConfig" const getContactConfig = cache(async (lang: Lang) => { const getContactConfigCounter = createCounter( diff --git a/apps/scandic-web/server/routers/contentstack/base/utils.ts b/packages/trpc/lib/routers/contentstack/base/utils.ts similarity index 86% rename from apps/scandic-web/server/routers/contentstack/base/utils.ts rename to packages/trpc/lib/routers/contentstack/base/utils.ts index daf4575a0..87e5bac9c 100644 --- a/apps/scandic-web/server/routers/contentstack/base/utils.ts +++ b/packages/trpc/lib/routers/contentstack/base/utils.ts @@ -1,14 +1,14 @@ -import { getValueFromContactConfig } from "@/utils/contactConfig" +import { getValueFromContactConfig } from "../../../utils/contactConfig" -import type { FooterRefDataRaw } from "@/types/components/footer/footer" -import type { System } from "@/types/requests/system" -import type { Edges } from "@/types/requests/utils/edges" -import type { NodeRefs } from "@/types/requests/utils/refs" -import type { HeaderRefs } from "@/types/trpc/routers/contentstack/header" +import type { Edges } from "../../../types/edges" +import type { FooterRefDataRaw } from "../../../types/footer" +import type { HeaderRefs } from "../../../types/header" +import type { NodeRefs } from "../../../types/refs" import type { AlertOutput, GetSiteConfigRefData, -} from "@/types/trpc/routers/contentstack/siteConfig" +} from "../../../types/siteConfig" +import type { System } from "../schemas/system" import type { ContactConfig } from "./output" export function getConnections({ header }: HeaderRefs) { diff --git a/apps/scandic-web/server/routers/contentstack/breadcrumbs/index.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/breadcrumbs/index.ts rename to packages/trpc/lib/routers/contentstack/breadcrumbs/index.ts index 2057c29e2..8ecbc2744 100644 --- a/apps/scandic-web/server/routers/contentstack/breadcrumbs/index.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { breadcrumbsQueryRouter } from "./query" export const breadcrumbsRouter = mergeRouters(breadcrumbsQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/breadcrumbs/output.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts similarity index 96% rename from apps/scandic-web/server/routers/contentstack/breadcrumbs/output.ts rename to packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts index 992aae57e..52c0f9cd4 100644 --- a/apps/scandic-web/server/routers/contentstack/breadcrumbs/output.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { systemSchema } from "../schemas/system" import { homeBreadcrumbs } from "./utils" diff --git a/apps/scandic-web/server/routers/contentstack/breadcrumbs/query.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts similarity index 88% rename from apps/scandic-web/server/routers/contentstack/breadcrumbs/query.ts rename to packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts index 2dfa4a0b0..ba0cc3178 100644 --- a/apps/scandic-web/server/routers/contentstack/breadcrumbs/query.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts @@ -1,64 +1,62 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." +import { PageContentTypeEnum } from "../../../enums/contentType" import { GetMyPagesBreadcrumbs, GetMyPagesBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/AccountPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/AccountPage.graphql" import { GetCampaignOverviewPageBreadcrumbs, GetCampaignOverviewPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql" import { GetCampaignPageBreadcrumbs, GetCampaignPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/CampaignPage.graphql" import { GetCollectionPageBreadcrumbs, GetCollectionPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/CollectionPage.graphql" import { GetContentPageBreadcrumbs, GetContentPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/ContentPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/ContentPage.graphql" import { GetDestinationCityPageBreadcrumbs, GetDestinationCityPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/DestinationCityPage.graphql" import { GetDestinationCountryPageBreadcrumbs, GetDestinationCountryPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/DestinationCountryPage.graphql" import { GetDestinationOverviewPageBreadcrumbs, GetDestinationOverviewPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql" import { GetHotelPageBreadcrumbs, GetHotelPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/HotelPage.graphql" +} from "../../../graphql/Query/Breadcrumbs/HotelPage.graphql" import { GetLoyaltyPageBreadcrumbs, GetLoyaltyPageBreadcrumbsRefs, -} from "@/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/Breadcrumbs/LoyaltyPage.graphql" +import { request } from "../../../graphql/request" +import { generateRefsResponseTag } from "../../../utils/generateTag" import { breadcrumbsRefsSchema, breadcrumbsSchema } from "./output" import { getTags } from "./utils" import type { Lang } from "@scandic-hotels/common/constants/language" -import { PageContentTypeEnum } from "@/types/requests/contentType" import type { BreadcrumbsRefsSchema, RawBreadcrumbsSchema, -} from "@/types/trpc/routers/contentstack/breadcrumbs" +} from "../../../types/breadcrumbs" interface BreadcrumbsPageData { dataKey: keyof T diff --git a/apps/scandic-web/server/routers/contentstack/breadcrumbs/utils.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts similarity index 80% rename from apps/scandic-web/server/routers/contentstack/breadcrumbs/utils.ts rename to packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts index 2eaff6bc1..3ec45f962 100644 --- a/apps/scandic-web/server/routers/contentstack/breadcrumbs/utils.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts @@ -1,10 +1,10 @@ import { Lang } from "@scandic-hotels/common/constants/language" -import { generateTag, generateTags } from "@/utils/generateTag" +import { generateTag, generateTags } from "../../../utils/generateTag" -import type { Edges } from "@/types/requests/utils/edges" -import type { NodeRefs } from "@/types/requests/utils/refs" -import type { BreadcrumbsRefsSchema } from "@/types/trpc/routers/contentstack/breadcrumbs" +import type { BreadcrumbsRefsSchema } from "../../../types/breadcrumbs" +import type { Edges } from "../../../types/edges" +import type { NodeRefs } from "../../../types/refs" export const affix = "breadcrumbs" diff --git a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/index.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/index.ts similarity index 74% rename from apps/scandic-web/server/routers/contentstack/campaignOverviewPage/index.ts rename to packages/trpc/lib/routers/contentstack/campaignOverviewPage/index.ts index bbf2d0e79..150266402 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { campaignOverviewPageQueryRouter } from "./query" export const campaignOverviewPageRouter = mergeRouters( diff --git a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/output.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/campaignOverviewPage/output.ts rename to packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts index cf7e9bff8..bb1bdcc5e 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts @@ -1,20 +1,18 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" +import { CampaignPageEnum } from "../../../types/campaignPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { campaignPageHotelListing, heroSchema, includedHotelsSchema, -} from "@/server/routers/contentstack/campaignPage/output" +} from "../campaignPage/output" import { linkAndTitleSchema, linkConnectionRefs, -} from "@/server/routers/contentstack/schemas/linkConnection" - +} from "../schemas/linkConnection" import { systemSchema } from "../schemas/system" -import { CampaignPageEnum } from "@/types/enums/campaignPage" - const navigationLinksSchema = z .array(linkAndTitleSchema) .nullable() diff --git a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts similarity index 87% rename from apps/scandic-web/server/routers/contentstack/campaignOverviewPage/query.ts rename to packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts index 956a88595..6a1c6aab7 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts @@ -1,30 +1,25 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" +import { request } from "@scandic-hotels/trpc/graphql/request" import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" +import { generateRefsResponseTag } from "@scandic-hotels/trpc/utils/generateTag" import { GetCampaignOverviewPage, GetCampaignOverviewPageRefs, -} from "@/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" import { campaignOverviewPageRefsSchema, campaignOverviewPageSchema, } from "./output" import { generatePageTags } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" import type { GetCampaignOverviewPageData, GetCampaignOverviewPageRefsData, -} from "@/types/trpc/routers/contentstack/campaignOverviewPage" +} from "../../../types/campaignOverviewPage" +import type { TrackingPageData } from "../../types" export const campaignOverviewPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { @@ -115,12 +110,12 @@ export const campaignOverviewPageQueryRouter = router({ const system = campaignOverviewPage.system const pageName = `campaign-overview-page` - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: system.uid, domainLanguage: system.locale, publishDate: system.updated_at, createDate: system.created_at, - channel: TrackingChannelEnum["campaign-overview-page"], + channel: "campaign-overview-page", pageType: "campaign-overview-page", pageName, siteSections: pageName, diff --git a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts similarity index 77% rename from apps/scandic-web/server/routers/contentstack/campaignOverviewPage/utils.ts rename to packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts index 9fd9f20b7..5b09b8413 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignOverviewPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts @@ -1,9 +1,12 @@ -import { generateTag, generateTagsFromSystem } from "@/utils/generateTag" +import { + generateTag, + generateTagsFromSystem, +} from "@scandic-hotels/trpc/utils/generateTag" import type { Lang } from "@scandic-hotels/common/constants/language" +import type { System } from "@scandic-hotels/trpc/routers/contentstack/schemas/system" -import type { System } from "@/types/requests/system" -import type { CampaignOverviewPageRefs } from "@/types/trpc/routers/contentstack/campaignOverviewPage" +import type { CampaignOverviewPageRefs } from "../../../types/campaignOverviewPage" export function generatePageTags( validatedData: CampaignOverviewPageRefs, diff --git a/apps/scandic-web/server/routers/contentstack/campaignPage/index.ts b/packages/trpc/lib/routers/contentstack/campaignPage/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/campaignPage/index.ts rename to packages/trpc/lib/routers/contentstack/campaignPage/index.ts index 1702e5f5a..36c16c921 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { campaignPageQueryRouter } from "./query" export const campaignPageRouter = mergeRouters(campaignPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/campaignPage/output.ts b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/campaignPage/output.ts rename to packages/trpc/lib/routers/contentstack/campaignPage/output.ts index 25581fb5a..2f47d48ac 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { CampaignPageEnum } from "../../../types/campaignPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { accordionRefsSchema, accordionSchema, @@ -19,8 +19,6 @@ import { } from "../schemas/linkConnection" import { systemSchema } from "../schemas/system" -import { CampaignPageEnum } from "@/types/enums/campaignPage" - const campaignPageEssentials = z .object({ __typename: z.literal(CampaignPageEnum.ContentStack.blocks.Essentials), diff --git a/apps/scandic-web/server/routers/contentstack/campaignPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts similarity index 85% rename from apps/scandic-web/server/routers/contentstack/campaignPage/query.ts rename to packages/trpc/lib/routers/contentstack/campaignPage/query.ts index 18a26fb7a..f1a196c0d 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts @@ -1,27 +1,22 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetCampaignPage, GetCampaignPageRefs, -} from "@/lib/graphql/Query/CampaignPage/CampaignPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/CampaignPage/CampaignPage.graphql" +import { request } from "../../../graphql/request" +import { generateRefsResponseTag } from "../../../utils/generateTag" import { campaignPageRefsSchema, campaignPageSchema } from "./output" import { generatePageTags } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" import type { GetCampaignPageData, GetCampaignPageRefsData, -} from "@/types/trpc/routers/contentstack/campaignPage" +} from "../../../types/campaignPage" +import type { TrackingPageData } from "../../types" export const campaignPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { @@ -106,12 +101,12 @@ export const campaignPageQueryRouter = router({ const system = campaignPage.system const pageName = `campaign-page` - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: system.uid, domainLanguage: system.locale, publishDate: system.updated_at, createDate: system.created_at, - channel: TrackingChannelEnum["campaign-page"], + channel: "campaign-page", pageType: "campaign-page", pageName, siteSections: pageName, diff --git a/apps/scandic-web/server/routers/contentstack/campaignPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts similarity index 80% rename from apps/scandic-web/server/routers/contentstack/campaignPage/utils.ts rename to packages/trpc/lib/routers/contentstack/campaignPage/utils.ts index eeec30981..da006cd7a 100644 --- a/apps/scandic-web/server/routers/contentstack/campaignPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts @@ -1,10 +1,10 @@ -import { generateTag, generateTagsFromSystem } from "@/utils/generateTag" +import { CampaignPageEnum } from "../../../types/campaignPage" +import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" import type { Lang } from "@scandic-hotels/common/constants/language" -import { CampaignPageEnum } from "@/types/enums/campaignPage" -import type { System } from "@/types/requests/system" -import type { CampaignPageRefs } from "@/types/trpc/routers/contentstack/campaignPage" +import type { CampaignPageRefs } from "../../../types/campaignPage" +import type { System } from "../schemas/system" export function generatePageTags( validatedData: CampaignPageRefs, diff --git a/apps/scandic-web/server/routers/contentstack/collectionPage/index.ts b/packages/trpc/lib/routers/contentstack/collectionPage/index.ts similarity index 70% rename from apps/scandic-web/server/routers/contentstack/collectionPage/index.ts rename to packages/trpc/lib/routers/contentstack/collectionPage/index.ts index 29c04247b..4c2aef959 100644 --- a/apps/scandic-web/server/routers/contentstack/collectionPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { collectionPageQueryRouter } from "./query" export const collectionPageRouter = mergeRouters(collectionPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/collectionPage/output.ts b/packages/trpc/lib/routers/contentstack/collectionPage/output.ts similarity index 96% rename from apps/scandic-web/server/routers/contentstack/collectionPage/output.ts rename to packages/trpc/lib/routers/contentstack/collectionPage/output.ts index 21202b844..19de82044 100644 --- a/apps/scandic-web/server/routers/contentstack/collectionPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { CollectionPageEnum } from "../../../types/collectionPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { cardGridRefsSchema, cardsGridSchema, @@ -22,8 +22,6 @@ import { } from "../schemas/linkConnection" import { systemSchema } from "../schemas/system" -import { CollectionPageEnum } from "@/types/enums/collectionPage" - // Block schemas export const collectionPageCards = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/collectionPage/query.ts b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts similarity index 80% rename from apps/scandic-web/server/routers/contentstack/collectionPage/query.ts rename to packages/trpc/lib/routers/contentstack/collectionPage/query.ts index 609236572..febc347c4 100644 --- a/apps/scandic-web/server/routers/contentstack/collectionPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts @@ -1,10 +1,9 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" -import { GetCollectionPage } from "@/lib/graphql/Query/CollectionPage/CollectionPage.graphql" -import { request } from "@/lib/graphql/request" - +import { router } from "../../.." +import { GetCollectionPage } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" +import { request } from "../../../graphql/request" import { collectionPageSchema } from "./output" import { fetchCollectionPageRefs, @@ -12,11 +11,8 @@ import { validateCollectionPageRefs, } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" -import type { GetCollectionPageSchema } from "@/types/trpc/routers/contentstack/collectionPage" +import type { GetCollectionPageSchema } from "../../../types/collectionPage" +import type { TrackingPageData } from "../../types" export const collectionPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -62,12 +58,12 @@ export const collectionPageQueryRouter = router({ metricsGetCollectionPage.success() - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: collectionPage.data.collection_page.system.uid, domainLanguage: lang, publishDate: collectionPage.data.collection_page.system.updated_at, createDate: collectionPage.data.collection_page.system.created_at, - channel: TrackingChannelEnum["collection-page"], + channel: "collection-page", pageType: "collectionpage", pageName: collectionPage.data.trackingProps.url, siteSections: collectionPage.data.trackingProps.url, diff --git a/apps/scandic-web/server/routers/contentstack/collectionPage/utils.ts b/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts similarity index 87% rename from apps/scandic-web/server/routers/contentstack/collectionPage/utils.ts rename to packages/trpc/lib/routers/contentstack/collectionPage/utils.ts index c6117b197..5295effc3 100644 --- a/apps/scandic-web/server/routers/contentstack/collectionPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts @@ -1,25 +1,23 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { notFound } from "@scandic-hotels/trpc/errors" -import { GetCollectionPageRefs } from "@/lib/graphql/Query/CollectionPage/CollectionPage.graphql" -import { request } from "@/lib/graphql/request" - +import { GetCollectionPageRefs } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" +import { request } from "../../../graphql/request" +import { + CollectionPageEnum, + type CollectionPageRefs, + type GetCollectionPageRefsSchema, +} from "../../../types/collectionPage" import { generateRefsResponseTag, generateTag, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { collectionPageRefsSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import { CollectionPageEnum } from "@/types/enums/collectionPage" -import type { System } from "@/types/requests/system" -import type { - CollectionPageRefs, - GetCollectionPageRefsSchema, -} from "@/types/trpc/routers/contentstack/collectionPage" +import type { System } from "../schemas/system" export async function fetchCollectionPageRefs(lang: Lang, uid: string) { const getCollectionPageRefsCounter = createCounter( diff --git a/apps/scandic-web/server/routers/contentstack/contentPage/index.ts b/packages/trpc/lib/routers/contentstack/contentPage/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/contentPage/index.ts rename to packages/trpc/lib/routers/contentstack/contentPage/index.ts index 4a933fa24..aa158631e 100644 --- a/apps/scandic-web/server/routers/contentstack/contentPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { contentPageQueryRouter } from "./query" export const contentPageRouter = mergeRouters(contentPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/contentPage/output.ts b/packages/trpc/lib/routers/contentstack/contentPage/output.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/contentPage/output.ts rename to packages/trpc/lib/routers/contentstack/contentPage/output.ts index e03979ee0..76ad5edb5 100644 --- a/apps/scandic-web/server/routers/contentstack/contentPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { ContentPageEnum } from "../../../types/contentPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { accordionRefsSchema, accordionSchema, @@ -58,8 +58,6 @@ import { } from "../schemas/sidebar/teaserCard" import { systemSchema } from "../schemas/system" -import { ContentPageEnum } from "@/types/enums/contentPage" - // Block schemas export const contentPageCards = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/contentPage/query.ts b/packages/trpc/lib/routers/contentstack/contentPage/query.ts similarity index 70% rename from apps/scandic-web/server/routers/contentstack/contentPage/query.ts rename to packages/trpc/lib/routers/contentstack/contentPage/query.ts index a248843e6..904d3335f 100644 --- a/apps/scandic-web/server/routers/contentstack/contentPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/query.ts @@ -1,24 +1,18 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" -import { batchRequest } from "@/lib/graphql/batchRequest" +import { router } from "../../.." +import { batchRequest } from "../../../graphql/batchRequest" import { GetContentPage, GetContentPageBlocksBatch1, GetContentPageBlocksBatch2, -} from "@/lib/graphql/Query/ContentPage/ContentPage.graphql" - +} from "../../../graphql/Query/ContentPage/ContentPage.graphql" import { contentPageSchema } from "./output" -import { - createChannel, - createPageType, - fetchContentPageRefs, - generatePageTags, -} from "./utils" +import { fetchContentPageRefs, generatePageTags } from "./utils" -import type { TrackingSDKPageData } from "@/types/components/tracking" -import type { GetContentPageSchema } from "@/types/trpc/routers/contentstack/contentPage" +import type { GetContentPageSchema } from "../../../types/contentPage" +import type { TrackingPageData } from "../../types" export const contentPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -80,7 +74,7 @@ export const contentPageQueryRouter = router({ metricsGetContentPage.success() - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: contentPage.data.content_page.system.uid, domainLanguage: lang, publishDate: contentPage.data.content_page.system.updated_at, @@ -98,3 +92,27 @@ export const contentPageQueryRouter = router({ } }), }) + +const signupContentPageUid = "blt0e6bd6c4d7224f07" +const signupVerifyContentPageUid = "blt3247a2a29b34a8e8" + +export function createChannel(uid: string): TrackingPageData["channel"] { + switch (uid) { + case signupContentPageUid: + case signupVerifyContentPageUid: + return "scandic-friends" + default: + return "static-content-page" + } +} + +export function createPageType(uid: string): string { + switch (uid) { + case signupContentPageUid: + return "memberprofilecreatepage" + case signupVerifyContentPageUid: + return "memberprofilecreatesuccesspage" + default: + return "staticcontentpage" + } +} diff --git a/apps/scandic-web/server/routers/contentstack/contentPage/utils.ts b/packages/trpc/lib/routers/contentstack/contentPage/utils.ts similarity index 81% rename from apps/scandic-web/server/routers/contentstack/contentPage/utils.ts rename to packages/trpc/lib/routers/contentstack/contentPage/utils.ts index 4e9e0cfdf..0a82f3a0a 100644 --- a/apps/scandic-web/server/routers/contentstack/contentPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/utils.ts @@ -1,29 +1,26 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { notFound } from "@scandic-hotels/trpc/errors" -import { batchRequest } from "@/lib/graphql/batchRequest" +import { batchRequest } from "../../../graphql/batchRequest" import { GetContentPageBlocksRefs, GetContentPageRefs, -} from "@/lib/graphql/Query/ContentPage/ContentPage.graphql" - +} from "../../../graphql/Query/ContentPage/ContentPage.graphql" +import { ContentPageEnum } from "../../../types/contentPage" import { generateRefsResponseTag, generateTag, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { contentPageRefsSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import { TrackingChannelEnum } from "@/types/components/tracking" -import { ContentPageEnum } from "@/types/enums/contentPage" -import type { System } from "@/types/requests/system" -import { - type ContentPageRefs, - type GetContentPageRefsSchema, -} from "@/types/trpc/routers/contentstack/contentPage" +import type { + ContentPageRefs, + GetContentPageRefsSchema, +} from "../../../types/contentPage" +import type { System } from "../schemas/system" export async function fetchContentPageRefs(lang: Lang, uid: string) { const getContentPageRefsCounter = createCounter( @@ -178,27 +175,3 @@ export function getConnections({ content_page }: ContentPageRefs) { } return connections } - -const signupContentPageUid = "blt0e6bd6c4d7224f07" -const signupVerifyContentPageUid = "blt3247a2a29b34a8e8" - -export function createPageType(uid: string): string { - switch (uid) { - case signupContentPageUid: - return "memberprofilecreatepage" - case signupVerifyContentPageUid: - return "memberprofilecreatesuccesspage" - default: - return "staticcontentpage" - } -} - -export function createChannel(uid: string): TrackingChannelEnum { - switch (uid) { - case signupContentPageUid: - case signupVerifyContentPageUid: - return TrackingChannelEnum["scandic-friends"] - default: - return TrackingChannelEnum["static-content-page"] - } -} diff --git a/apps/scandic-web/server/routers/contentstack/destinationCityPage/index.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/index.ts similarity index 73% rename from apps/scandic-web/server/routers/contentstack/destinationCityPage/index.ts rename to packages/trpc/lib/routers/contentstack/destinationCityPage/index.ts index 87dd50070..7f8e9c8c6 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCityPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { destinationCityPageQueryRouter } from "./query" export const destinationCityPageRouter = mergeRouters( diff --git a/apps/scandic-web/server/routers/contentstack/destinationCityPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/destinationCityPage/output.ts rename to packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts index 0d8b8d301..6ad72e449 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCityPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts @@ -1,10 +1,10 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" -import { isDefined } from "@/server/utils" - -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { DestinationCityPageEnum } from "../../../types/destinationCityPage" +import { isDefined } from "../../../utils" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { accordionRefsSchema, accordionSchema, @@ -19,8 +19,7 @@ import { } from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" -import type { ImageVaultAsset } from "@/types/components/imageVault" -import { DestinationCityPageEnum } from "@/types/enums/destinationCityPage" +import type { ImageVaultAsset } from "../../../types/imageVault" const destinationCityPageDestinationSettingsSchema = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/destinationCityPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts similarity index 88% rename from apps/scandic-web/server/routers/contentstack/destinationCityPage/query.ts rename to packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts index 3a8534296..cf011c8a6 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCityPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts @@ -1,16 +1,14 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetDestinationCityPage, GetDestinationCityPageRefs, -} from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/DestinationCityPage/DestinationCityPage.graphql" +import { request } from "../../../graphql/request" +import { generateRefsResponseTag } from "../../../utils/generateTag" import { getCityByCityIdentifier } from "../../hotels/utils" import { destinationCityPageRefsSchema, @@ -18,14 +16,11 @@ import { } from "./output" import { generatePageTags } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" import type { GetDestinationCityPageData, GetDestinationCityPageRefsSchema, -} from "@/types/trpc/routers/contentstack/destinationCityPage" +} from "../../../types/destinationCityPage" +import type { TrackingPageData } from "../../types" export const destinationCityPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { @@ -129,12 +124,12 @@ export const destinationCityPageQueryRouter = router({ const system = destinationCityPage.system const pageName = `destinations|${city.country}|${city.name}` - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: system.uid, domainLanguage: system.locale, publishDate: system.updated_at, createDate: system.created_at, - channel: TrackingChannelEnum.hotels, + channel: "hotels", pageType: "citypage", pageName, siteSections: pageName, diff --git a/apps/scandic-web/server/routers/contentstack/destinationCityPage/utils.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts similarity index 88% rename from apps/scandic-web/server/routers/contentstack/destinationCityPage/utils.ts rename to packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts index 6a8b8c9f3..18f4b4ba9 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCityPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts @@ -1,22 +1,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { GetCityPageCount } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql" -import { GetCityPageUrls } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql" -import { request } from "@/lib/graphql/request" - -import { generateTag, generateTagsFromSystem } from "@/utils/generateTag" - +import { GetCityPageCount } from "../../../graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql" +import { GetCityPageUrls } from "../../../graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql" +import { request } from "../../../graphql/request" +import { DestinationCityPageEnum } from "../../../types/destinationCityPage" +import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" import { batchedCityPageUrlsSchema, cityPageCountSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import { DestinationCityPageEnum } from "@/types/enums/destinationCityPage" -import type { System } from "@/types/requests/system" import type { DestinationCityPageRefs, GetCityPageCountData, GetCityPageUrlsData, -} from "@/types/trpc/routers/contentstack/destinationCityPage" +} from "../../../types/destinationCityPage" +import type { System } from "../schemas/system" export function generatePageTags( validatedData: DestinationCityPageRefs, diff --git a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/index.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/index.ts similarity index 74% rename from apps/scandic-web/server/routers/contentstack/destinationCountryPage/index.ts rename to packages/trpc/lib/routers/contentstack/destinationCountryPage/index.ts index ff39f7b73..b481242eb 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { destinationCountryPageQueryRouter } from "./query" export const destinationCountryPageRouter = mergeRouters( diff --git a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/input.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/input.ts similarity index 68% rename from apps/scandic-web/server/routers/contentstack/destinationCountryPage/input.ts rename to packages/trpc/lib/routers/contentstack/destinationCountryPage/input.ts index 9afd554ef..e01850d0e 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/input.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/input.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { Country } from "@/types/enums/country" +import { Country } from "../../../types/country" export const getCityPagesInput = z.object({ country: z.nativeEnum(Country), diff --git a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/destinationCountryPage/output.ts rename to packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts index 551b0450b..fd4ab6415 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts @@ -1,9 +1,10 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { Country } from "../../../types/country" +import { DestinationCountryPageEnum } from "../../../types/destinationCountryPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { accordionRefsSchema, accordionSchema, @@ -18,9 +19,7 @@ import { } from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" -import type { ImageVaultAsset } from "@/types/components/imageVault" -import { Country } from "@/types/enums/country" -import { DestinationCountryPageEnum } from "@/types/enums/destinationCountryPage" +import type { ImageVaultAsset } from "../../../types/imageVault" export const destinationCountryPageContent = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts similarity index 87% rename from apps/scandic-web/server/routers/contentstack/destinationCountryPage/query.ts rename to packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts index 804a12cb3..00e86d59e 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts @@ -1,19 +1,18 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentStackBaseWithServiceProcedure, contentstackExtendedProcedureUID, } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetDestinationCountryPage, GetDestinationCountryPageRefs, -} from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" +import { request } from "../../../graphql/request" +import { ApiCountry } from "../../../types/country" +import { generateRefsResponseTag } from "../../../utils/generateTag" import { getCityPagesInput } from "./input" import { destinationCountryPageRefsSchema, @@ -21,15 +20,11 @@ import { } from "./output" import { generatePageTags, getCityPages } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" -import { ApiCountry } from "@/types/enums/country" import type { GetDestinationCountryPageData, GetDestinationCountryPageRefsSchema, -} from "@/types/trpc/routers/contentstack/destinationCountryPage" +} from "../../../types/destinationCountryPage" +import type { TrackingPageData } from "../../types" export const destinationCountryPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -117,12 +112,12 @@ export const destinationCountryPageQueryRouter = router({ const system = destinationCountryPage.system const pageName = `destinations|${country}` - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: system.uid, domainLanguage: system.locale, publishDate: system.updated_at, createDate: system.created_at, - channel: TrackingChannelEnum.hotels, + channel: "hotels", pageType: "countrypage", pageName, siteSections: pageName, diff --git a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/utils.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts similarity index 86% rename from apps/scandic-web/server/routers/contentstack/destinationCountryPage/utils.ts rename to packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts index 3a9e06847..8a99946d0 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationCountryPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts @@ -1,25 +1,23 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { GetDestinationCityListData } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql" -import { GetCountryPageUrls } from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql" -import { request } from "@/lib/graphql/request" - -import { generateTag, generateTagsFromSystem } from "@/utils/generateTag" - +import { GetDestinationCityListData } from "../../../graphql/Query/DestinationCityPage/DestinationCityListData.graphql" +import { GetCountryPageUrls } from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql" +import { request } from "../../../graphql/request" +import { ApiCountry, type Country } from "../../../types/country" +import { DestinationCountryPageEnum } from "../../../types/destinationCountryPage" +import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" import { getCitiesByCountry } from "../../hotels/utils" import { destinationCityListDataSchema } from "../destinationCityPage/output" import { countryPageUrlsSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import { ApiCountry, type Country } from "@/types/enums/country" -import { DestinationCountryPageEnum } from "@/types/enums/destinationCountryPage" -import type { System } from "@/types/requests/system" -import type { GetDestinationCityListDataResponse } from "@/types/trpc/routers/contentstack/destinationCityPage" +import type { GetDestinationCityListDataResponse } from "../../../types/destinationCityPage" import type { DestinationCountryPageRefs, GetCountryPageUrlsData, -} from "@/types/trpc/routers/contentstack/destinationCountryPage" +} from "../../../types/destinationCountryPage" +import type { System } from "../schemas/system" export function generatePageTags( validatedData: DestinationCountryPageRefs, diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-da.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-da.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-da.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-da.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-de.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-de.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-de.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-de.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-en.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-en.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-en.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-en.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-fi.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-fi.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-fi.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-fi.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-no.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-no.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-no.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-no.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-sv.json b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-sv.json similarity index 100% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/destinations-sv.json rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/destinations-sv.json diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/index.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/index.ts similarity index 75% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/index.ts rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/index.ts index e86e251b4..677605ea8 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { destinationOverviewPageQueryRouter } from "./query" export const destinationOverviewPageRouter = mergeRouters( diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/output.ts rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts index dd1621f17..14db8b9fb 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { DestinationOverviewPageEnum } from "../../../types/destinationOverviewPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { cardGalleryRefsSchema, cardGallerySchema, @@ -9,8 +9,6 @@ import { import { mapLocationSchema } from "../schemas/mapLocation" import { systemSchema } from "../schemas/system" -import { DestinationOverviewPageEnum } from "@/types/enums/destinationOverviewPage" - const destinationOverviewPageCardGallery = z .object({ __typename: z.literal( diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/query.ts rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts index aa62c56e7..e58978621 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts @@ -1,21 +1,23 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { createCounter } from "@scandic-hotels/common/telemetry" import { safeTry } from "@scandic-hotels/common/utils/safeTry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackExtendedProcedureUID, serviceProcedure, } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetDestinationOverviewPage, GetDestinationOverviewPageRefs, -} from "@/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateRefsResponseTag, generateTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" +import { request } from "../../../graphql/request" +import { ApiCountry, type Country } from "../../../types/country" +import { + generateRefsResponseTag, + generateTag, +} from "../../../utils/generateTag" import { getCitiesByCountry, getCountries, @@ -35,19 +37,12 @@ import { } from "./output" import { getSortedDestinationsByLanguage } from "./utils" -import type { - City, - DestinationsData, -} from "@/types/components/destinationOverviewPage/destinationsList/destinationsData" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" -import { ApiCountry, type Country } from "@/types/enums/country" import type { GetDestinationOverviewPageData, GetDestinationOverviewPageRefsSchema, -} from "@/types/trpc/routers/contentstack/destinationOverviewPage" +} from "../../../types/destinationOverviewPage" +import type { City, DestinationsData } from "../../../types/destinationsData" +import type { TrackingPageData } from "../../types" export const destinationOverviewPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -132,12 +127,12 @@ export const destinationOverviewPageQueryRouter = router({ metricsGetDestinationOverviewPage.success() const system = destinationOverviewPage.data.destination_overview_page.system - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: system.uid, domainLanguage: lang, publishDate: system.updated_at, createDate: system.created_at, - channel: TrackingChannelEnum.hotels, + channel: "hotels", pageType: "destinationoverviewpage", pageName: "destinations|overview", siteSections: "destinations|overview", diff --git a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/utils.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/utils.ts similarity index 89% rename from apps/scandic-web/server/routers/contentstack/destinationOverviewPage/utils.ts rename to packages/trpc/lib/routers/contentstack/destinationOverviewPage/utils.ts index 537ede5c1..30f961da2 100644 --- a/apps/scandic-web/server/routers/contentstack/destinationOverviewPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/utils.ts @@ -1,7 +1,8 @@ import { Lang } from "@scandic-hotels/common/constants/language" -import type { DestinationsData } from "@/types/components/destinationOverviewPage/destinationsList/destinationsData" -import { ApiCountry, Country } from "@/types/enums/country" +import { ApiCountry, Country } from "../../../types/country" + +import type { DestinationsData } from "../../../types/destinationsData" /** * Sorts destination data based on language preference: diff --git a/apps/scandic-web/server/routers/contentstack/hotelPage/index.ts b/packages/trpc/lib/routers/contentstack/hotelPage/index.ts similarity index 68% rename from apps/scandic-web/server/routers/contentstack/hotelPage/index.ts rename to packages/trpc/lib/routers/contentstack/hotelPage/index.ts index b6b60e4e4..9e956b041 100644 --- a/apps/scandic-web/server/routers/contentstack/hotelPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { hotelPageQueryRouter } from "./query" export const hotelPageRouter = mergeRouters(hotelPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/hotelPage/output.ts b/packages/trpc/lib/routers/contentstack/hotelPage/output.ts similarity index 93% rename from apps/scandic-web/server/routers/contentstack/hotelPage/output.ts rename to packages/trpc/lib/routers/contentstack/hotelPage/output.ts index 0669f3b77..930359cd4 100644 --- a/apps/scandic-web/server/routers/contentstack/hotelPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/output.ts @@ -1,9 +1,9 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { HotelPageEnum } from "../../../types/hotelPageEnum" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { activitiesCardRefSchema, activitiesCardSchema, @@ -12,11 +12,7 @@ import { hotelFaqRefsSchema, hotelFaqSchema } from "../schemas/blocks/hotelFaq" import { spaPageRefSchema, spaPageSchema } from "../schemas/blocks/spaPage" import { systemSchema } from "../schemas/system" -import { HotelPageEnum } from "@/types/enums/hotelPage" -import type { - ActivitiesCard, - SpaPage, -} from "@/types/trpc/routers/contentstack/hotelPage" +import type { ActivitiesCard, SpaPage } from "../../../types/hotelPage" const contentBlockActivities = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/hotelPage/query.ts b/packages/trpc/lib/routers/contentstack/hotelPage/query.ts similarity index 80% rename from apps/scandic-web/server/routers/contentstack/hotelPage/query.ts rename to packages/trpc/lib/routers/contentstack/hotelPage/query.ts index 021190ce5..95467b17c 100644 --- a/apps/scandic-web/server/routers/contentstack/hotelPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/query.ts @@ -1,16 +1,14 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" -import { GetHotelPage } from "@/lib/graphql/Query/HotelPage/HotelPage.graphql" -import { request } from "@/lib/graphql/request" - -import { generateTag } from "@/utils/generateTag" - +import { router } from "../../.." +import { GetHotelPage } from "../../../graphql/Query/HotelPage/HotelPage.graphql" +import { request } from "../../../graphql/request" +import { generateTag } from "../../../utils/generateTag" import { hotelPageSchema } from "./output" -import type { GetHotelPageData } from "@/types/trpc/routers/contentstack/hotelPage" +import type { GetHotelPageData } from "../../../types/hotelPage" export const hotelPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { diff --git a/apps/scandic-web/server/routers/contentstack/hotelPage/utils.ts b/packages/trpc/lib/routers/contentstack/hotelPage/utils.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/hotelPage/utils.ts rename to packages/trpc/lib/routers/contentstack/hotelPage/utils.ts index 3262ae2ff..4bb950aea 100644 --- a/apps/scandic-web/server/routers/contentstack/hotelPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/utils.ts @@ -1,9 +1,8 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { GetHotelPageCount } from "@/lib/graphql/Query/HotelPage/HotelPageCount.graphql" -import { GetHotelPageUrls } from "@/lib/graphql/Query/HotelPage/HotelPageUrl.graphql" -import { request } from "@/lib/graphql/request" - +import { GetHotelPageCount } from "../../../graphql/Query/HotelPage/HotelPageCount.graphql" +import { GetHotelPageUrls } from "../../../graphql/Query/HotelPage/HotelPageUrl.graphql" +import { request } from "../../../graphql/request" import { batchedHotelPageUrlsSchema, hotelPageCountSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" @@ -11,7 +10,7 @@ import type { Lang } from "@scandic-hotels/common/constants/language" import type { GetHotelPageCountData, GetHotelPageUrlsData, -} from "@/types/trpc/routers/contentstack/hotelPage" +} from "../../../types/hotelPage" export async function getHotelPageCount(lang: Lang) { const getHotelPageCountCounter = createCounter( diff --git a/apps/scandic-web/server/routers/contentstack/index.ts b/packages/trpc/lib/routers/contentstack/index.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/index.ts rename to packages/trpc/lib/routers/contentstack/index.ts index cce713d99..32d2abd37 100644 --- a/apps/scandic-web/server/routers/contentstack/index.ts +++ b/packages/trpc/lib/routers/contentstack/index.ts @@ -1,5 +1,4 @@ -import { router } from "@scandic-hotels/trpc" - +import { router } from "../.." import { accountPageRouter } from "./accountPage" import { baseRouter } from "./base" import { breadcrumbsRouter } from "./breadcrumbs" diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/index.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/index.ts similarity index 71% rename from apps/scandic-web/server/routers/contentstack/languageSwitcher/index.ts rename to packages/trpc/lib/routers/contentstack/languageSwitcher/index.ts index 0877c7db2..f356c8b19 100644 --- a/apps/scandic-web/server/routers/contentstack/languageSwitcher/index.ts +++ b/packages/trpc/lib/routers/contentstack/languageSwitcher/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { languageSwitcherQueryRouter } from "./query" export const languageSwitcherRouter = mergeRouters(languageSwitcherQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/input.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/input.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/languageSwitcher/input.ts rename to packages/trpc/lib/routers/contentstack/languageSwitcher/input.ts diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/output.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/output.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/languageSwitcher/output.ts rename to packages/trpc/lib/routers/contentstack/languageSwitcher/output.ts diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts similarity index 78% rename from apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts rename to packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts index 7ed3698f1..c3cf9169f 100644 --- a/apps/scandic-web/server/routers/contentstack/languageSwitcher/query.ts +++ b/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts @@ -1,13 +1,12 @@ -import { router } from "@scandic-hotels/trpc" import { publicProcedure } from "@scandic-hotels/trpc/procedures" -import { getUidAndContentTypeByPath } from "@/services/cms/getUidAndContentTypeByPath" - +import { router } from "../../.." +import { getUidAndContentTypeByPath } from "../../../services/cms/getUidAndContentTypeByPath" import { getNonContentstackUrls } from "../metadata/output" import { getLanguageSwitcherInput } from "./input" import { getUrlsOfAllLanguages } from "./utils" -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" +import type { LanguageSwitcherData } from "../../../types/languageSwitcher" export const languageSwitcherQueryRouter = router({ get: publicProcedure diff --git a/apps/scandic-web/server/routers/contentstack/languageSwitcher/utils.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts similarity index 82% rename from apps/scandic-web/server/routers/contentstack/languageSwitcher/utils.ts rename to packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts index cbd19388d..8b9879a82 100644 --- a/apps/scandic-web/server/routers/contentstack/languageSwitcher/utils.ts +++ b/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts @@ -1,67 +1,65 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { createCounter } from "@scandic-hotels/common/telemetry" +import { removeTrailingSlash } from "@scandic-hotels/common/utils/url" import { internalServerError } from "@scandic-hotels/trpc/errors" -import { batchRequest } from "@/lib/graphql/batchRequest" +import { PageContentTypeEnum } from "../../../enums/contentType" +import { batchRequest } from "../../../graphql/batchRequest" import { GetDaDeEnUrlsAccountPage, GetFiNoSvUrlsAccountPage, -} from "@/lib/graphql/Query/AccountPage/AccountPage.graphql" +} from "../../../graphql/Query/AccountPage/AccountPage.graphql" import { GetDaDeEnUrlsCampaignOverviewPage, GetFiNoSvUrlsCampaignOverviewPage, -} from "@/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" +} from "../../../graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" import { GetDaDeEnUrlsCampaignPage, GetFiNoSvUrlsCampaignPage, -} from "@/lib/graphql/Query/CampaignPage/CampaignPage.graphql" +} from "../../../graphql/Query/CampaignPage/CampaignPage.graphql" import { GetDaDeEnUrlsCollectionPage, GetFiNoSvUrlsCollectionPage, -} from "@/lib/graphql/Query/CollectionPage/CollectionPage.graphql" +} from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" import { GetDaDeEnUrlsContentPage, GetFiNoSvUrlsContentPage, -} from "@/lib/graphql/Query/ContentPage/ContentPage.graphql" +} from "../../../graphql/Query/ContentPage/ContentPage.graphql" import { GetDaDeEnUrlsCurrentBlocksPage, GetFiNoSvUrlsCurrentBlocksPage, -} from "@/lib/graphql/Query/Current/LanguageSwitcher.graphql" +} from "../../../graphql/Query/Current/LanguageSwitcher.graphql" import { GetDaDeEnUrlsDestinationCityPage, GetFiNoSvUrlsDestinationCityPage, -} from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql" +} from "../../../graphql/Query/DestinationCityPage/DestinationCityPage.graphql" import { GetDaDeEnUrlsDestinationCountryPage, GetFiNoSvUrlsDestinationCountryPage, -} from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" +} from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" import { GetDaDeEnUrlsDestinationOverviewPage, GetFiNoSvUrlsDestinationOverviewPage, -} from "@/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" +} from "../../../graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" import { GetDaDeEnUrlsHotelPage, GetFiNoSvUrlsHotelPage, -} from "@/lib/graphql/Query/HotelPage/HotelPage.graphql" +} from "../../../graphql/Query/HotelPage/HotelPage.graphql" import { GetDaDeEnUrlsLoyaltyPage, GetFiNoSvUrlsLoyaltyPage, -} from "@/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql" +} from "../../../graphql/Query/LoyaltyPage/LoyaltyPage.graphql" import { GetDaDeEnUrlsStartPage, GetFiNoSvUrlsStartPage, -} from "@/lib/graphql/Query/StartPage/StartPage.graphql" - -import { generateTag } from "@/utils/generateTag" -import { removeTrailingSlash } from "@/utils/url" - +} from "../../../graphql/Query/StartPage/StartPage.graphql" +import { generateTag } from "../../../utils/generateTag" import { validateLanguageSwitcherData } from "./output" -import { PageContentTypeEnum } from "@/types/requests/contentType" import type { LanguageSwitcherData, LanguageSwitcherQueryDataRaw, -} from "@/types/requests/languageSwitcher" +} from "../../../types/languageSwitcher" export const languageSwitcherAffix = "languageSwitcher" diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/index.ts b/packages/trpc/lib/routers/contentstack/loyaltyLevel/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/loyaltyLevel/index.ts rename to packages/trpc/lib/routers/contentstack/loyaltyLevel/index.ts index cb174ec51..08e6a87c1 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/index.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyLevel/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { loyaltyLevelQueryRouter } from "./query" export const loyaltyLevelRouter = mergeRouters(loyaltyLevelQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/input.ts b/packages/trpc/lib/routers/contentstack/loyaltyLevel/input.ts similarity index 71% rename from apps/scandic-web/server/routers/contentstack/loyaltyLevel/input.ts rename to packages/trpc/lib/routers/contentstack/loyaltyLevel/input.ts index 05e3d450c..955e90957 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/input.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyLevel/input.ts @@ -1,8 +1,7 @@ import { z } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" - -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" export const loyaltyLevelInput = z.object({ level: z.nativeEnum(MembershipLevelEnum), diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/output.ts b/packages/trpc/lib/routers/contentstack/loyaltyLevel/output.ts similarity index 76% rename from apps/scandic-web/server/routers/contentstack/loyaltyLevel/output.ts rename to packages/trpc/lib/routers/contentstack/loyaltyLevel/output.ts index 95a7d0924..0b06435e5 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/output.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyLevel/output.ts @@ -1,6 +1,8 @@ import { z } from "zod" -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" + +import type { CMSReward } from "../../../types/reward" export const validateLoyaltyLevelsSchema = z .object({ @@ -22,3 +24,5 @@ export const validateLoyaltyLevelsSchema = z export type LoyaltyLevelsResponse = z.input export type LoyaltyLevel = z.output[number] + +export type LevelWithRewards = LoyaltyLevel & { rewards: CMSReward[] } diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/query.ts b/packages/trpc/lib/routers/contentstack/loyaltyLevel/query.ts similarity index 89% rename from apps/scandic-web/server/routers/contentstack/loyaltyLevel/query.ts rename to packages/trpc/lib/routers/contentstack/loyaltyLevel/query.ts index 9b9d66079..f31981bea 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyLevel/query.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyLevel/query.ts @@ -1,22 +1,20 @@ import { cache } from "react" -import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" - import { type MembershipLevel, MembershipLevelEnum, -} from "@/constants/membershipLevels" +} from "@scandic-hotels/common/constants/membershipLevels" +import { createCounter } from "@scandic-hotels/common/telemetry" + +import { router } from "../../.." +import { notFound } from "../../../errors" import { GetAllLoyaltyLevels, GetLoyaltyLevel, -} from "@/lib/graphql/Query/LoyaltyLevels.graphql" -import { request } from "@/lib/graphql/request" - -import { generateLoyaltyConfigTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/LoyaltyLevels.graphql" +import { request } from "../../../graphql/request" +import { contentstackBaseProcedure } from "../../../procedures" +import { generateLoyaltyConfigTag } from "../../../utils/generateTag" import { loyaltyLevelInput } from "./input" import { type LoyaltyLevel, diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyPage/index.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/loyaltyPage/index.ts rename to packages/trpc/lib/routers/contentstack/loyaltyPage/index.ts index aa1d6a6fa..611766026 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { loyaltyPageQueryRouter } from "./query" export const loyaltyPageRouter = mergeRouters(loyaltyPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyPage/output.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/loyaltyPage/output.ts rename to packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts index edf8fd1db..820be2319 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { LoyaltyPageEnum } from "../../../enums/loyaltyPage" +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { cardGridRefsSchema, cardsGridSchema, @@ -30,8 +30,6 @@ import { } from "../schemas/sidebar/joinLoyaltyContact" import { systemSchema } from "../schemas/system" -import { LoyaltyPageEnum } from "@/types/enums/loyaltyPage" - // LoyaltyPage Refs const extendedCardGridRefsSchema = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyPage/query.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts similarity index 86% rename from apps/scandic-web/server/routers/contentstack/loyaltyPage/query.ts rename to packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts index 622aa48ec..aea8bde4a 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts @@ -1,31 +1,26 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." import { GetLoyaltyPage, GetLoyaltyPageRefs, -} from "@/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql" -import { request } from "@/lib/graphql/request" - +} from "../../../graphql/Query/LoyaltyPage/LoyaltyPage.graphql" +import { request } from "../../../graphql/request" import { generateRefsResponseTag, generateTag, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { loyaltyPageRefsSchema, loyaltyPageSchema } from "./output" import { getConnections } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" import type { GetLoyaltyPageRefsSchema, GetLoyaltyPageSchema, -} from "@/types/trpc/routers/contentstack/loyaltyPage" +} from "../../../types/loyaltyPage" +import type { TrackingPageData } from "../../types" export const loyaltyPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -106,12 +101,12 @@ export const loyaltyPageQueryRouter = router({ const loyaltyPage = validatedLoyaltyPage.data.loyalty_page - const loyaltyTrackingData: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageId: loyaltyPage.system.uid, domainLanguage: lang, publishDate: loyaltyPage.system.updated_at, createDate: loyaltyPage.system.created_at, - channel: TrackingChannelEnum["scandic-friends"], + channel: "scandic-friends", pageType: "loyaltycontentpage", pageName: validatedLoyaltyPage.data.trackingProps.url, siteSections: validatedLoyaltyPage.data.trackingProps.url, @@ -123,7 +118,7 @@ export const loyaltyPageQueryRouter = router({ // Assert LoyaltyPage type to get correct typings for RTE fields return { loyaltyPage, - tracking: loyaltyTrackingData, + tracking, } }), }) diff --git a/apps/scandic-web/server/routers/contentstack/loyaltyPage/utils.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts similarity index 89% rename from apps/scandic-web/server/routers/contentstack/loyaltyPage/utils.ts rename to packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts index cf2de76c6..0974b3dea 100644 --- a/apps/scandic-web/server/routers/contentstack/loyaltyPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts @@ -1,6 +1,7 @@ -import { LoyaltyPageEnum } from "@/types/enums/loyaltyPage" -import type { System } from "@/types/requests/system" -import type { LoyaltyPageRefs } from "@/types/trpc/routers/contentstack/loyaltyPage" +import { LoyaltyPageEnum } from "../../../enums/loyaltyPage" + +import type { LoyaltyPageRefs } from "../../../types/loyaltyPage" +import type { System } from "../schemas/system" export function getConnections({ loyalty_page }: LoyaltyPageRefs) { const connections: System["system"][] = [loyalty_page.system] diff --git a/packages/trpc/lib/routers/contentstack/metadata/helpers.ts b/packages/trpc/lib/routers/contentstack/metadata/helpers.ts new file mode 100644 index 000000000..db7dbf387 --- /dev/null +++ b/packages/trpc/lib/routers/contentstack/metadata/helpers.ts @@ -0,0 +1,67 @@ +import type { + CategorizedFilters, + Filter, +} from "../../../types/destinationFilterAndSort" +import type { DestinationPagesHotelData } from "../../../types/hotel" + +const HOTEL_SURROUNDINGS_FILTER_TYPE_NAMES = [ + "Hotel surroundings", + "Hotel omgivelser", + "Hotelumgebung", + "Hotellia lähellä", + "Hotellomgivelser", + "Omgivningar", +] + +const HOTEL_FACILITIES_FILTER_TYPE_NAMES = [ + "Hotel facilities", + "Hotellfaciliteter", + "Hotelfaciliteter", + "Hotel faciliteter", + "Hotel-Infos", + "Hotellin palvelut", +] + +export function getFiltersFromHotels( + hotels: DestinationPagesHotelData[] +): CategorizedFilters { + if (hotels.length === 0) { + return { facilityFilters: [], surroundingsFilters: [] } + } + + const filters = hotels.flatMap(({ hotel }) => hotel.detailedFacilities) + const uniqueFilterNames = [...new Set(filters.map((filter) => filter.name))] + const filterList = uniqueFilterNames + .map((filterName) => { + const filter = filters.find((filter) => filter.name === filterName) + return filter + ? { + name: filter.name, + slug: filter.slug, + filterType: filter.filter, + sortOrder: filter.sortOrder, + } + : null + }) + .filter((filter): filter is Filter => !!filter) + + const facilityFilters = filterList.filter((filter) => + HOTEL_FACILITIES_FILTER_TYPE_NAMES.includes(filter.filterType) + ) + const surroundingsFilters = filterList.filter((filter) => + HOTEL_SURROUNDINGS_FILTER_TYPE_NAMES.includes(filter.filterType) + ) + return { + facilityFilters: sortFilters(facilityFilters), + surroundingsFilters: sortFilters(surroundingsFilters), + } +} + +function sortFilters(filters: Filter[]): Filter[] { + return [...filters].sort((a, b) => { + // First sort by sortOrder + const orderDiff = a.sortOrder - b.sortOrder + // If sortOrder is the same, sort by name as secondary criterion + return orderDiff === 0 ? a.name.localeCompare(b.name) : orderDiff + }) +} diff --git a/apps/scandic-web/server/routers/contentstack/metadata/index.ts b/packages/trpc/lib/routers/contentstack/metadata/index.ts similarity index 67% rename from apps/scandic-web/server/routers/contentstack/metadata/index.ts rename to packages/trpc/lib/routers/contentstack/metadata/index.ts index f2282a2c4..88b7c0a9e 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/index.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { metadataQueryRouter } from "./query" export const metadataRouter = mergeRouters(metadataQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/metadata/input.ts b/packages/trpc/lib/routers/contentstack/metadata/input.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/metadata/input.ts rename to packages/trpc/lib/routers/contentstack/metadata/input.ts index 836a4645e..dc36b28d9 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/input.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/input.ts @@ -5,3 +5,5 @@ export const getMetadataInput = z.object({ filterFromUrl: z.string().optional(), noIndex: z.boolean().default(false), }) + +export interface MetadataInputSchema extends z.input {} diff --git a/apps/scandic-web/server/routers/contentstack/metadata/output.ts b/packages/trpc/lib/routers/contentstack/metadata/output.ts similarity index 79% rename from apps/scandic-web/server/routers/contentstack/metadata/output.ts rename to packages/trpc/lib/routers/contentstack/metadata/output.ts index 201dc26fd..0b462c7fb 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/output.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/output.ts @@ -1,27 +1,20 @@ import { z } from "zod" -import { baseUrls } from "@/constants/routes/baseUrls" -import { findMyBooking } from "@/constants/routes/findMyBooking" -import { hotelreservation } from "@/constants/routes/hotelReservation" -import { myStay } from "@/constants/routes/myStay" -import { env } from "@/env/server" +import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" +import { myStay } from "@scandic-hotels/common/constants/routes/myStay" -import { attributesSchema as hotelAttributesSchema } from "../../hotels/schemas/hotel" +import { attributesSchema as hotelAttributesSchema } from "../../../routers/hotels/schemas/hotel" +import { Country } from "../../../types/country" +import { RTETypeEnum } from "../../../types/RTEenums" import { additionalDataAttributesSchema } from "../../hotels/schemas/hotel/include/additionalData" import { imageSchema } from "../../hotels/schemas/image" import { tempImageVaultAssetSchema } from "../schemas/imageVault" import { systemSchema } from "../schemas/system" -import { getDescription } from "./utils/description" -import { getImage } from "./utils/image" -import { getTitle } from "./utils/title" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { Metadata } from "next" -import type { ImageVaultAsset } from "@/types/components/imageVault" -import { Country } from "@/types/enums/country" -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" -import { RTETypeEnum } from "@/types/rte/enums" +import type { ImageVaultAsset } from "../../../types/imageVault" +import type { LanguageSwitcherData } from "../../../types/languageSwitcher" const metaDataJsonSchema = z.object({ children: z.array( @@ -166,26 +159,7 @@ export const rawMetadataSchema = z.object({ system: systemSchema, }) -export const metadataSchema = rawMetadataSchema.transform(async (data) => { - const noIndex = !!data.web?.seo_metadata?.noindex - - const metadata: Metadata = { - metadataBase: env.PUBLIC_URL ? new URL(env.PUBLIC_URL) : undefined, - title: await getTitle(data), - description: await getDescription(data), - openGraph: { - images: getImage(data), - }, - } - - if (noIndex) { - metadata.robots = { - index: false, - follow: false, - } - } - return metadata -}) +export interface RawMetadataSchema extends z.output {} // Several pages are not currently routed within contentstack context. // This function is used to generate the urls for these pages. @@ -212,3 +186,16 @@ export function getNonContentstackUrls(lang: Lang, pathName: string) { return { [lang]: { url: pathName } } } + +const baseUrls: LanguageSwitcherData = { + da: { url: "/da/" }, + de: { url: "/de/" }, + en: { url: "/en/" }, + fi: { url: "/fi/" }, + no: { url: "/no/" }, + sv: { url: "/sv/" }, +} + +function hotelreservation(lang: Lang) { + return `/${lang}/hotelreservation` +} diff --git a/apps/scandic-web/server/routers/contentstack/metadata/query.ts b/packages/trpc/lib/routers/contentstack/metadata/query.ts similarity index 62% rename from apps/scandic-web/server/routers/contentstack/metadata/query.ts rename to packages/trpc/lib/routers/contentstack/metadata/query.ts index 6af6fa57f..46dbd9704 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/query.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/query.ts @@ -1,38 +1,34 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" -import { env } from "@/env/server" -import { GetAccountPageMetadata } from "@/lib/graphql/Query/AccountPage/Metadata.graphql" -import { GetCampaignOverviewPageMetadata } from "@/lib/graphql/Query/CampaignOverviewPage/Metadata.graphql" -import { GetCampaignPageMetadata } from "@/lib/graphql/Query/CampaignPage/Metadata.graphql" -import { GetCollectionPageMetadata } from "@/lib/graphql/Query/CollectionPage/Metadata.graphql" -import { GetContentPageMetadata } from "@/lib/graphql/Query/ContentPage/Metadata.graphql" -import { GetDestinationCityPageMetadata } from "@/lib/graphql/Query/DestinationCityPage/Metadata.graphql" -import { GetDestinationCountryPageMetadata } from "@/lib/graphql/Query/DestinationCountryPage/Metadata.graphql" -import { GetDestinationOverviewPageMetadata } from "@/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql" -import { GetHotelPageMetadata } from "@/lib/graphql/Query/HotelPage/Metadata.graphql" -import { GetLoyaltyPageMetadata } from "@/lib/graphql/Query/LoyaltyPage/Metadata.graphql" -import { GetStartPageMetadata } from "@/lib/graphql/Query/StartPage/Metadata.graphql" -import { request } from "@/lib/graphql/request" - -import { generateTag } from "@/utils/generateTag" - +import { router } from "../../.." +import { PageContentTypeEnum } from "../../../enums/contentType" +import { GetAccountPageMetadata } from "../../../graphql/Query/AccountPage/Metadata.graphql" +import { GetCampaignOverviewPageMetadata } from "../../../graphql/Query/CampaignOverviewPage/Metadata.graphql" +import { GetCampaignPageMetadata } from "../../../graphql/Query/CampaignPage/Metadata.graphql" +import { GetCollectionPageMetadata } from "../../../graphql/Query/CollectionPage/Metadata.graphql" +import { GetContentPageMetadata } from "../../../graphql/Query/ContentPage/Metadata.graphql" +import { GetDestinationCityPageMetadata } from "../../../graphql/Query/DestinationCityPage/Metadata.graphql" +import { GetDestinationCountryPageMetadata } from "../../../graphql/Query/DestinationCountryPage/Metadata.graphql" +import { GetDestinationOverviewPageMetadata } from "../../../graphql/Query/DestinationOverviewPage/Metadata.graphql" +import { GetHotelPageMetadata } from "../../../graphql/Query/HotelPage/Metadata.graphql" +import { GetLoyaltyPageMetadata } from "../../../graphql/Query/LoyaltyPage/Metadata.graphql" +import { GetStartPageMetadata } from "../../../graphql/Query/StartPage/Metadata.graphql" +import { request } from "../../../graphql/request" +import { generateTag } from "../../../utils/generateTag" import { getHotel } from "../../hotels/utils" import { getUrlsOfAllLanguages } from "../languageSwitcher/utils" import { getMetadataInput } from "./input" -import { getNonContentstackUrls, metadataSchema } from "./output" +import { getNonContentstackUrls, rawMetadataSchema } from "./output" import { affix, getCityData, getCountryData } from "./utils" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { Metadata } from "next" -import { PageContentTypeEnum } from "@/types/requests/contentType" -import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher" -import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata" +import type { LanguageSwitcherData } from "../../../types/languageSwitcher" +import type { RawMetadataSchema } from "./output" const fetchMetadata = cache(async function fetchMemoizedMetadata( query: string, @@ -63,25 +59,14 @@ const fetchMetadata = cache(async function fetchMemoizedMetadata( return response.data }) -async function getTransformedMetadata(data: unknown) { - const transformMetadataCounter = createCounter( - "trpc.contentstack", - "metadata.transform" - ) - const metricsTransformMetadata = transformMetadataCounter.init() +type Alternates = { + canonical?: string | null + languages?: Record +} - metricsTransformMetadata.start() - - const validatedMetadata = await metadataSchema.safeParseAsync(data) - - if (!validatedMetadata.success) { - metricsTransformMetadata.validationError(validatedMetadata.error) - return null - } - - metricsTransformMetadata.success() - - return validatedMetadata.data +type Robots = { + index?: boolean + follow?: boolean } export const metadataQueryRouter = router({ @@ -105,85 +90,60 @@ export const metadataQueryRouter = router({ urls = await getUrlsOfAllLanguages(ctx.lang, ctx.uid, ctx.contentType) } - let alternates: Metadata["alternates"] = null - - if (urls) { - const languages: Record = {} - Object.entries(urls).forEach(([lang, { url }]) => { - languages[lang] = url - }) - const canonical = urls[ctx.lang]?.url - alternates = { - canonical, - languages, - } - } - - let metadata: Metadata | null = null + let data: unknown = null switch (ctx.contentType) { case PageContentTypeEnum.accountPage: const accountPageResponse = await fetchMetadata<{ account_page: RawMetadataSchema }>(GetAccountPageMetadata, variables) - metadata = await getTransformedMetadata( - accountPageResponse.account_page - ) + data = accountPageResponse.account_page break case PageContentTypeEnum.campaignOverviewPage: const campaignOverviewPageResponse = await fetchMetadata<{ campaign_overview_page: RawMetadataSchema }>(GetCampaignOverviewPageMetadata, variables) - metadata = await getTransformedMetadata( - campaignOverviewPageResponse.campaign_overview_page - ) + data = campaignOverviewPageResponse.campaign_overview_page break case PageContentTypeEnum.campaignPage: const campaignPageResponse = await fetchMetadata<{ campaign_page: RawMetadataSchema }>(GetCampaignPageMetadata, variables) - metadata = await getTransformedMetadata( - campaignPageResponse.campaign_page - ) + data = campaignPageResponse.campaign_page break case PageContentTypeEnum.collectionPage: const collectionPageResponse = await fetchMetadata<{ collection_page: RawMetadataSchema }>(GetCollectionPageMetadata, variables) - metadata = await getTransformedMetadata( - collectionPageResponse.collection_page - ) + data = collectionPageResponse.collection_page break case PageContentTypeEnum.contentPage: const contentPageResponse = await fetchMetadata<{ content_page: RawMetadataSchema }>(GetContentPageMetadata, variables) - metadata = await getTransformedMetadata( - contentPageResponse.content_page - ) + data = contentPageResponse.content_page break case PageContentTypeEnum.destinationOverviewPage: const destinationOverviewPageResponse = await fetchMetadata<{ destination_overview_page: RawMetadataSchema }>(GetDestinationOverviewPageMetadata, variables) - metadata = await getTransformedMetadata( - destinationOverviewPageResponse.destination_overview_page - ) + data = destinationOverviewPageResponse.destination_overview_page break case PageContentTypeEnum.destinationCountryPage: const destinationCountryPageResponse = await fetchMetadata<{ destination_country_page: RawMetadataSchema }>(GetDestinationCountryPageMetadata, variables) + const countryData = await getCountryData( destinationCountryPageResponse.destination_country_page, input, ctx.serviceToken, ctx.lang ) - metadata = await getTransformedMetadata({ + data = { ...destinationCountryPageResponse.destination_country_page, destinationData: countryData, - }) + } break case PageContentTypeEnum.destinationCityPage: const destinationCityPageResponse = await fetchMetadata<{ @@ -195,18 +155,16 @@ export const metadataQueryRouter = router({ ctx.serviceToken, ctx.lang ) - metadata = await getTransformedMetadata({ + data = { ...destinationCityPageResponse.destination_city_page, destinationData: cityData, - }) + } break case PageContentTypeEnum.loyaltyPage: const loyaltyPageResponse = await fetchMetadata<{ loyalty_page: RawMetadataSchema }>(GetLoyaltyPageMetadata, variables) - metadata = await getTransformedMetadata( - loyaltyPageResponse.loyalty_page - ) + data = loyaltyPageResponse.loyalty_page break case PageContentTypeEnum.hotelPage: const hotelPageResponse = await fetchMetadata<{ @@ -223,8 +181,7 @@ export const metadataQueryRouter = router({ ctx.serviceToken ) : null - - metadata = await getTransformedMetadata({ + data = { ...hotelPageData, ...(hotelData ? { @@ -234,32 +191,61 @@ export const metadataQueryRouter = router({ } : {}), subpageUrl: input.subpage, - }) + } break case PageContentTypeEnum.startPage: const startPageResponse = await fetchMetadata<{ start_page: RawMetadataSchema }>(GetStartPageMetadata, variables) - metadata = await getTransformedMetadata(startPageResponse.start_page) + data = startPageResponse.start_page + break default: break } - if (metadata) { - if (alternates) { - // Hiding alternates until all languages are released in production - if (env.NEW_SITE_LIVE_STATUS === "ALL_LANGUAGES_LIVE") { - metadata.alternates = alternates - } - } - if (input.noIndex) { - metadata.robots = { - index: false, - follow: false, - } + let alternates: Alternates | null = null + let robots: Robots | null = null + + if (urls) { + const languages: Record = {} + Object.entries(urls).forEach(([lang, { url }]) => { + languages[lang] = url + }) + const canonical = urls[ctx.lang]?.url + alternates = { + canonical, + languages, } } - return { metadata, alternates } + if (!data) { + alternates = null + } + + if (input.noIndex) { + robots = { + index: false, + follow: false, + } + } + + const transformMetadataCounter = createCounter( + "trpc.contentstack", + "metadata.transform" + ) + const metricsTransformMetadata = transformMetadataCounter.init() + + metricsTransformMetadata.start() + + const rawMetadataResult = await rawMetadataSchema.safeParseAsync(data) + + if (!rawMetadataResult.success) { + metricsTransformMetadata.validationError(rawMetadataResult.error) + return { rawMetadata: null, robots: null, alternates: null } + } + + metricsTransformMetadata.success() + + return { rawMetadata: rawMetadataResult.data, robots, alternates } }), }) diff --git a/apps/scandic-web/server/routers/contentstack/metadata/utils/index.ts b/packages/trpc/lib/routers/contentstack/metadata/utils.ts similarity index 88% rename from apps/scandic-web/server/routers/contentstack/metadata/utils/index.ts rename to packages/trpc/lib/routers/contentstack/metadata/utils.ts index 002b95991..5a8cd1dae 100644 --- a/apps/scandic-web/server/routers/contentstack/metadata/utils/index.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/utils.ts @@ -1,24 +1,19 @@ -import { - getFiltersFromHotels, - getSortedCities, -} from "@/stores/destination-data/helper" - +import { SortOption } from "../../../enums/destinationFilterAndSort" +import { ApiCountry } from "../../../types/country" +import { getSortedCities } from "../../../utils/getSortedCities" import { getCityByCityIdentifier, getHotelIdsByCityIdentifier, getHotelIdsByCountry, getHotelsByHotelIds, -} from "../../../hotels/utils" -import { getCityPages } from "../../destinationCountryPage/utils" +} from "../../hotels/utils" +import { getCityPages } from "../destinationCountryPage/utils" +import { getFiltersFromHotels } from "./helpers" import type { Lang } from "@scandic-hotels/common/constants/language" -import { ApiCountry } from "@/types/enums/country" -import { SortOption } from "@/types/enums/destinationFilterAndSort" -import type { - MetadataInputSchema, - RawMetadataSchema, -} from "@/types/trpc/routers/contentstack/metadata" +import type { MetadataInputSchema } from "./input" +import type { RawMetadataSchema } from "./output" export const affix = "metadata" diff --git a/apps/scandic-web/server/routers/contentstack/pageSettings/index.ts b/packages/trpc/lib/routers/contentstack/pageSettings/index.ts similarity index 69% rename from apps/scandic-web/server/routers/contentstack/pageSettings/index.ts rename to packages/trpc/lib/routers/contentstack/pageSettings/index.ts index e16c05982..be8992d20 100644 --- a/apps/scandic-web/server/routers/contentstack/pageSettings/index.ts +++ b/packages/trpc/lib/routers/contentstack/pageSettings/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { pageSettingsQueryRouter } from "./query" export const pageSettingsRouter = mergeRouters(pageSettingsQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/pageSettings/output.ts b/packages/trpc/lib/routers/contentstack/pageSettings/output.ts similarity index 88% rename from apps/scandic-web/server/routers/contentstack/pageSettings/output.ts rename to packages/trpc/lib/routers/contentstack/pageSettings/output.ts index 24555d826..5ccde4549 100644 --- a/apps/scandic-web/server/routers/contentstack/pageSettings/output.ts +++ b/packages/trpc/lib/routers/contentstack/pageSettings/output.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const pageSettingsSchema = z.object({ hide_booking_widget: z.boolean(), diff --git a/apps/scandic-web/server/routers/contentstack/pageSettings/query.ts b/packages/trpc/lib/routers/contentstack/pageSettings/query.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/pageSettings/query.ts rename to packages/trpc/lib/routers/contentstack/pageSettings/query.ts index 2e947e12c..06e4b9a6e 100644 --- a/apps/scandic-web/server/routers/contentstack/pageSettings/query.ts +++ b/packages/trpc/lib/routers/contentstack/pageSettings/query.ts @@ -1,8 +1,9 @@ import * as Sentry from "@sentry/nextjs" -import { router } from "@scandic-hotels/trpc" import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." +import { PageContentTypeEnum } from "../../../enums/contentType" import { GetAccountPageSettings, GetCampaignOverviewPageSettings, @@ -16,12 +17,10 @@ import { GetHotelPageSettings, GetLoyaltyPageSettings, GetStartPageSettings, -} from "@/lib/graphql/Query/PageSettings.graphql" -import { request } from "@/lib/graphql/request" -import { langInput } from "@/server/utils" - -import { generateTag } from "@/utils/generateTag" - +} from "../../../graphql/Query/PageSettings.graphql" +import { request } from "../../../graphql/request" +import { langInput } from "../../../utils" +import { generateTag } from "../../../utils/generateTag" import { DEFAULT_GET_PAGE_SETTINGS, type GetPageSettingsSchema, @@ -29,8 +28,6 @@ import { } from "./output" import { affix } from "./utils" -import { PageContentTypeEnum } from "@/types/requests/contentType" - export const pageSettingsQueryRouter = router({ get: contentstackBaseProcedure .input(langInput) diff --git a/apps/scandic-web/server/routers/contentstack/pageSettings/utils.ts b/packages/trpc/lib/routers/contentstack/pageSettings/utils.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/pageSettings/utils.ts rename to packages/trpc/lib/routers/contentstack/pageSettings/utils.ts diff --git a/apps/scandic-web/server/routers/contentstack/partner/index.ts b/packages/trpc/lib/routers/contentstack/partner/index.ts similarity index 67% rename from apps/scandic-web/server/routers/contentstack/partner/index.ts rename to packages/trpc/lib/routers/contentstack/partner/index.ts index 9aad4af51..1f361be98 100644 --- a/apps/scandic-web/server/routers/contentstack/partner/index.ts +++ b/packages/trpc/lib/routers/contentstack/partner/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { partnerQueryRouter } from "./query" export const partnerRouter = mergeRouters(partnerQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/partner/output.ts b/packages/trpc/lib/routers/contentstack/partner/output.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/partner/output.ts rename to packages/trpc/lib/routers/contentstack/partner/output.ts diff --git a/apps/scandic-web/server/routers/contentstack/partner/query.ts b/packages/trpc/lib/routers/contentstack/partner/query.ts similarity index 85% rename from apps/scandic-web/server/routers/contentstack/partner/query.ts rename to packages/trpc/lib/routers/contentstack/partner/query.ts index 161305492..980bb8ca8 100644 --- a/apps/scandic-web/server/routers/contentstack/partner/query.ts +++ b/packages/trpc/lib/routers/contentstack/partner/query.ts @@ -1,18 +1,18 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" import { notFound } from "@scandic-hotels/trpc/errors" import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" -import { GetAllSasTierComparison } from "@/lib/graphql/Query/SASTierComparison.graphql" -import { request } from "@/lib/graphql/request" - +import { router } from "../../.." +import { GetAllSasTierComparison } from "../../../graphql/Query/SASTierComparison.graphql" +import { request } from "../../../graphql/request" import { validateSasTierComparisonSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" +import type { z } from "zod" -import type { SasTierComparisonResponse } from "@/types/trpc/routers/contentstack/partner" +type SasTierComparisonResponse = z.input export const getSasTierComparison = cache(async (lang: Lang) => { const getSasTierComparisonCounter = createCounter( diff --git a/packages/trpc/lib/routers/contentstack/reward/helpers.ts b/packages/trpc/lib/routers/contentstack/reward/helpers.ts new file mode 100644 index 000000000..76671bfd5 --- /dev/null +++ b/packages/trpc/lib/routers/contentstack/reward/helpers.ts @@ -0,0 +1,48 @@ +import type { + ApiReward, + RedeemableCoupon, + SurpriseReward, +} from "../../../types/reward" + +export function getRedeemableRewards(rewards: ApiReward[]) { + return rewards + .filter((reward) => { + if ("coupon" in reward && reward.coupon.length > 0) { + if (reward.coupon.every((coupon) => coupon.state === "redeemed")) { + return false + } + } + return true + }) + .filter((reward) => { + if (isSurpriseReward(reward)) { + return !reward.coupon.some(({ unwrapped }) => !unwrapped) + } + return true + }) +} + +function isSurpriseReward(reward: ApiReward): reward is SurpriseReward { + return reward.rewardType === "Surprise" +} + +export function getUnwrappedSurpriseRewards(rewards: ApiReward[]) { + return rewards + .filter(isSurpriseReward) + .filter((reward) => getReedemableCoupons(reward).length) + .filter((reward) => { + const unwrappedCoupons = + reward.coupon.filter((coupon) => !coupon.unwrapped) || [] + + return unwrappedCoupons.length + }) +} + +export function getReedemableCoupons(reward: ApiReward): RedeemableCoupon[] { + if ("coupon" in reward) { + return reward.coupon.filter( + (coupon): coupon is RedeemableCoupon => coupon.state !== "redeemed" + ) + } + return [] +} diff --git a/apps/scandic-web/server/routers/contentstack/reward/index.ts b/packages/trpc/lib/routers/contentstack/reward/index.ts similarity index 66% rename from apps/scandic-web/server/routers/contentstack/reward/index.ts rename to packages/trpc/lib/routers/contentstack/reward/index.ts index 87084949d..a1d1e8d08 100644 --- a/apps/scandic-web/server/routers/contentstack/reward/index.ts +++ b/packages/trpc/lib/routers/contentstack/reward/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { rewardQueryRouter } from "./query" export const rewardRouter = mergeRouters(rewardQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/reward/input.ts b/packages/trpc/lib/routers/contentstack/reward/input.ts similarity index 84% rename from apps/scandic-web/server/routers/contentstack/reward/input.ts rename to packages/trpc/lib/routers/contentstack/reward/input.ts index 2ad7bcb79..1c7ec0c59 100644 --- a/apps/scandic-web/server/routers/contentstack/reward/input.ts +++ b/packages/trpc/lib/routers/contentstack/reward/input.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" export const rewardsByLevelInput = z.object({ level_id: z.nativeEnum(MembershipLevelEnum), diff --git a/apps/scandic-web/server/routers/contentstack/reward/output.ts b/packages/trpc/lib/routers/contentstack/reward/output.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/reward/output.ts rename to packages/trpc/lib/routers/contentstack/reward/output.ts index 3b77d63a6..b4224f89d 100644 --- a/apps/scandic-web/server/routers/contentstack/reward/output.ts +++ b/packages/trpc/lib/routers/contentstack/reward/output.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { MembershipLevelEnum } from "@/constants/membershipLevels" +import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" import { linkRefsUnionSchema, diff --git a/apps/scandic-web/server/routers/contentstack/reward/query.ts b/packages/trpc/lib/routers/contentstack/reward/query.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/reward/query.ts rename to packages/trpc/lib/routers/contentstack/reward/query.ts index 99181cf82..6061bff31 100644 --- a/apps/scandic-web/server/routers/contentstack/reward/query.ts +++ b/packages/trpc/lib/routers/contentstack/reward/query.ts @@ -1,21 +1,16 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" -import { notFound } from "@scandic-hotels/trpc/errors" + +import { router } from "../../.." +import * as api from "../../../api" +import { notFound } from "../../../errors" import { contentStackBaseWithProtectedProcedure, contentStackBaseWithServiceProcedure, protectedProcedure, -} from "@scandic-hotels/trpc/procedures" - -import * as api from "@/lib/api" -import { langInput } from "@/server/utils" - -import { - getRedeemableRewards, - getUnwrappedSurpriseRewards, -} from "@/utils/rewards" - +} from "../../../procedures" +import { langInput } from "../../../utils" import { getAllLoyaltyLevels, getLoyaltyLevel } from "../loyaltyLevel/query" +import { getRedeemableRewards, getUnwrappedSurpriseRewards } from "./helpers" import { rewardsAllInput, rewardsByLevelInput, @@ -29,9 +24,9 @@ import { getUniqueRewardIds, } from "./utils" -import type { BaseReward, Surprise } from "@/types/components/myPages/rewards" -import type { LevelWithRewards } from "@/types/components/overviewTable" -import type { CMSReward } from "@/types/trpc/routers/contentstack/reward" +import type { CMSReward } from "../../../types/reward" +import type { BaseReward, Surprise } from "../../../types/rewards" +import type { LevelWithRewards } from "../loyaltyLevel/output" export const rewardQueryRouter = router({ all: contentStackBaseWithServiceProcedure diff --git a/apps/scandic-web/server/routers/contentstack/reward/utils.ts b/packages/trpc/lib/routers/contentstack/reward/utils.ts similarity index 93% rename from apps/scandic-web/server/routers/contentstack/reward/utils.ts rename to packages/trpc/lib/routers/contentstack/reward/utils.ts index abf13298a..27b4752d3 100644 --- a/apps/scandic-web/server/routers/contentstack/reward/utils.ts +++ b/packages/trpc/lib/routers/contentstack/reward/utils.ts @@ -1,19 +1,17 @@ import { getCacheClient } from "@scandic-hotels/common/dataCache" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import * as api from "@/lib/api" +import * as api from "../../../api" +import { notFound } from "../../../errors" import { GetRewards as GetRewards, GetRewardsRef as GetRewardsRef, -} from "@/lib/graphql/Query/RewardsWithRedeem.graphql" -import { request } from "@/lib/graphql/request" - +} from "../../../graphql/Query/RewardsWithRedeem.graphql" +import { request } from "../../../graphql/request" import { generateLoyaltyConfigTag, generateRefsResponseTag, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { rewardRefsSchema, validateApiAllTiersSchema, @@ -25,7 +23,7 @@ import type { Lang } from "@scandic-hotels/common/constants/language" import type { CMSRewardsResponse, GetRewardRefsSchema, -} from "@/types/trpc/routers/contentstack/reward" +} from "../../../types/reward" export function getUniqueRewardIds(rewardIds: string[]) { const uniqueRewardIds = new Set(rewardIds) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts similarity index 99% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts index 0482703a5..112a07ccd 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { linkRefsUnionSchema, linkUnionSchema, @@ -7,8 +8,6 @@ import { } from "../pageLinks" import { sysAssetSchema } from "./sysAsset" -import { BlocksEnums } from "@/types/enums/blocks" - export const embeddedContentSchema = z.union([linkUnionSchema, sysAssetSchema]) export const accordionItemsSchema = z.array( diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/activitiesCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/activitiesCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts index f88cfca6e..321558319 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/activitiesCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts @@ -1,12 +1,11 @@ import { z } from "zod" -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { HotelPageEnum } from "../../../../types/hotelPageEnum" import { tempImageVaultAssetSchema } from "../imageVault" import { contentPageRefSchema, contentPageSchema } from "../pageLinks" -import { HotelPageEnum } from "@/types/enums/hotelPage" - export const activitiesCardSchema = z.object({ typename: z .literal(HotelPageEnum.ContentStack.blocks.ActivitiesCard) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts index 0c476f9aa..dcfe98e1b 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { contentCardRefSchema, contentCardSchema, @@ -8,8 +9,6 @@ import { import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" -import { BlocksEnums } from "@/types/enums/blocks" - export const cardGallerySchema = z.object({ typename: z .literal(BlocksEnums.block.CardGallery) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/contentCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/contentCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts index 0a244998e..89f018e52 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/contentCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts @@ -1,12 +1,11 @@ import { z } from "zod" +import { CardsEnum } from "../../../../../types/cardsEnum" import { tempImageVaultAssetSchema } from "../../imageVault" import { systemSchema } from "../../system" import { buttonSchema } from "../utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "../utils/linkConnection" -import { CardsEnum } from "@/types/enums/cards" - export const contentCardSchema = z.object({ __typename: z.literal(CardsEnum.ContentCard), title: z.string(), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/infoCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCard.ts similarity index 89% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/infoCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCard.ts index a6337e032..d21f7703c 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/infoCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCard.ts @@ -1,12 +1,18 @@ import { z } from "zod" +import { CardsEnum } from "../../../../../types/cardsEnum" import { tempImageVaultAssetSchema } from "../../imageVault" import { systemSchema } from "../../system" import { buttonSchema } from "../utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "../utils/linkConnection" -import { INFO_CARD_THEMES } from "@/types/components/blocks/infoCard" -import { CardsEnum } from "@/types/enums/cards" +const INFO_CARD_THEMES = [ + "one", + "two", + "three", + "primaryInverted", + "primaryStrong", +] as const export const infoCardBlockSchema = z.object({ __typename: z.literal(CardsEnum.InfoCard), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts index 584107d23..3459beae6 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts @@ -1,12 +1,11 @@ import { z } from "zod" +import { CardsEnum } from "../../../../../types/cardsEnum" import { tempImageVaultAssetSchema } from "../../imageVault" import { systemSchema } from "../../system" import { buttonSchema } from "../utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "../utils/linkConnection" -import { CardsEnum } from "@/types/enums/cards" - export const loyaltyCardBlockSchema = z.object({ __typename: z.literal(CardsEnum.LoyaltyCard), body_text: z.string().optional(), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/teaserCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/teaserCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts index 128d0f1a2..db4c7af4f 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cards/teaserCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { CardsEnum } from "../../../../../types/cardsEnum" import { tempImageVaultAssetSchema } from "../../imageVault" import { accountPageSchema, @@ -19,8 +20,6 @@ import { sysAssetSchema } from "../sysAsset" import { buttonSchema } from "../utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "../utils/linkConnection" -import { CardsEnum } from "@/types/enums/cards" - export const teaserCardBlockSchema = z.object({ __typename: z.literal(CardsEnum.TeaserCard), heading: z.string().default(""), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardsGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/cardsGrid.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts index 369b85f03..ae0c7cb83 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardsGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts @@ -1,5 +1,11 @@ import { z } from "zod" +import { scriptedCardThemeEnum } from "../../../../enums/scriptedCard" +import { BlocksEnums } from "../../../../types/blocks" +import { + CardsGridEnum, + CardsGridLayoutEnum, +} from "../../../../types/cardsGridEnum" import { tempImageVaultAssetSchema } from "../imageVault" import { systemSchema } from "../system" import { @@ -19,10 +25,6 @@ import { import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" -import { BlocksEnums } from "@/types/enums/blocks" -import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid" -import { scriptedCardThemeEnum } from "@/types/enums/scriptedCard" - export const cardBlockSchema = z.object({ __typename: z.literal(CardsGridEnum.cards.Card), // JSON - ImageVault Image diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts index 668d848eb..23dae869b 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { contentCardRefSchema, contentCardSchema, @@ -8,8 +9,6 @@ import { import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" -import { BlocksEnums } from "@/types/enums/blocks" - const commonFields = { heading: z.string().optional(), link: buttonSchema.nullish(), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/content.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts similarity index 96% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/content.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts index fdd451054..674c1be9a 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/content.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts @@ -1,5 +1,7 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" +import { ContentEnum } from "../../../../types/content" import { accountPageSchema, collectionPageSchema, @@ -18,9 +20,6 @@ import { } from "./imageContainer" import { sysAssetRefsSchema, sysAssetSchema } from "./sysAsset" -import { BlocksEnums } from "@/types/enums/blocks" -import { ContentEnum } from "@/types/enums/content" - export const contentSchema = z.object({ typename: z .literal(BlocksEnums.block.Content) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/contentEmbeds.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/contentEmbeds.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/contentEmbeds.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/contentEmbeds.ts diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts similarity index 93% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/dynamicContent.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts index 2781ded90..efe28e6f1 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts @@ -1,14 +1,13 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" +import { DynamicContentEnum } from "../../../../types/dynamicContent" import { linkRefsUnionSchema, linkUnionSchema, transformPageLink, } from "../pageLinks" -import { BlocksEnums } from "@/types/enums/blocks" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" - export const dynamicContentSchema = z.object({ typename: z .literal(BlocksEnums.block.DynamicContent) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/essentials.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/essentials.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts index 35733fc2a..b4e4e179a 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/essentials.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { BlocksEnums } from "@/types/enums/blocks" +import { BlocksEnums } from "../../../../types/blocks" export const essentialsSchema = z.object({ essentials: z.object({ diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/fullWidthCampaign.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts similarity index 93% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/fullWidthCampaign.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts index 20a9c0962..a45fb5a60 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/fullWidthCampaign.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts @@ -1,13 +1,11 @@ import { z } from "zod" -import * as pageLinks from "@/server/routers/contentstack/schemas/pageLinks" - +import * as pageLinks from "../../../../routers/contentstack/schemas/pageLinks" +import { BlocksEnums } from "../../../../types/blocks" import { tempImageVaultAssetSchema } from "../imageVault" import { systemSchema } from "../system" import { buttonSchema } from "./utils/buttonLinkSchema" -import { BlocksEnums } from "@/types/enums/blocks" - export const fullWidthCampaignSchema = z.object({ full_width_campaign: z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelFaq.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelFaq.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts index aade71e3d..6c2ddb4bb 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelFaq.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts @@ -1,14 +1,13 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" +import { HotelPageEnum } from "../../../../types/hotelPageEnum" import { accordionItemsSchema, globalAccordionConnectionRefs, specificAccordionConnectionRefs, } from "./accordion" -import { BlocksEnums } from "@/types/enums/blocks" -import { HotelPageEnum } from "@/types/enums/hotelPage" - export const hotelFaqSchema = z .object({ typename: z diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelListing.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelListing.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts index bc53e9b68..fc3523bf1 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/hotelListing.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { BlocksEnums } from "@/types/enums/blocks" -import { Country } from "@/types/enums/country" +import { BlocksEnums } from "../../../../types/blocks" +import { Country } from "../../../../types/country" export const locationFilterSchema = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/imageContainer.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts similarity index 91% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/imageContainer.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts index fd96fe876..de25ee3fb 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/imageContainer.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts @@ -1,10 +1,9 @@ import { z } from "zod" +import { ContentEnum } from "../../../../types/content" import { tempImageVaultAssetSchema } from "../imageVault" import { systemSchema } from "../system" -import { ContentEnum } from "@/types/enums/content" - export const imageContainerSchema = z.object({ __typename: z.literal(ContentEnum.blocks.ImageContainer), // JSON - ImageVault Image diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/joinScandicFriends.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/joinScandicFriends.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts index 6bb25a868..132ccbc7a 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/joinScandicFriends.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts @@ -1,11 +1,10 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { tempImageVaultAssetSchema } from "../imageVault" import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" -import { BlocksEnums } from "@/types/enums/blocks" - export const joinScandicFriendsSchema = z.object({ join_scandic_friends: z.object({ show_header: z.boolean().default(false), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/shortcuts.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts similarity index 97% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/shortcuts.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts index 534532bc4..4f8b09d22 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/shortcuts.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts @@ -1,13 +1,12 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { linkRefsUnionSchema, linkUnionSchema, transformPageLink, } from "../pageLinks" -import { BlocksEnums } from "@/types/enums/blocks" - export const shortcutsBlockSchema = z.object({ shortcuts: z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/spaPage.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/spaPage.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts index 974586be4..831c1b179 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/spaPage.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts @@ -1,11 +1,10 @@ import { z } from "zod" -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { HotelPageEnum } from "../../../../types/hotelPageEnum" import { collectionPageRefSchema, contentPageRefSchema } from "../pageLinks" -import { HotelPageEnum } from "@/types/enums/hotelPage" - export const spaPageSchema = z.object({ typename: z .literal(HotelPageEnum.ContentStack.blocks.SpaPage) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/sysAsset.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/sysAsset.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts index dbd3ad791..6fb69d59b 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/sysAsset.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { ContentEnum } from "@/types/enums/content" +import { ContentEnum } from "../../../../types/content" // SysAsset is used for several different assets in ContentStack, such as images, pdf-files, etc. // It is a generic asset type that can represent any file type. diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/table.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts similarity index 96% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/table.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts index 0083a0c25..56eaeeb2d 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/table.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { BlocksEnums } from "@/types/enums/blocks" +import { BlocksEnums } from "../../../../types/blocks" export const tableSchema = z.object({ typename: z diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/textCols.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/textCols.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts index 099497f17..3ac1925e9 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/textCols.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts @@ -1,5 +1,7 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" +import { ContentEnum } from "../../../../types/content" import { linkRefsUnionSchema, linkUnionSchema, @@ -7,9 +9,6 @@ import { } from "../pageLinks" import { sysAssetRefsSchema, sysAssetSchema } from "./sysAsset" -import { BlocksEnums } from "@/types/enums/blocks" -import { ContentEnum } from "@/types/enums/content" - export const textColsSchema = z.object({ typename: z .literal(BlocksEnums.block.TextCols) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/textContent.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/textContent.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts index 27ec6e1f9..92e17299b 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/textContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts @@ -1,9 +1,8 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" import { sysAssetSchema } from "./sysAsset" -import { BlocksEnums } from "@/types/enums/blocks" - export const textContentSchema = z.object({ typename: z .literal(BlocksEnums.block.TextContent) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/uspGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts similarity index 94% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/uspGrid.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts index 5e3b59536..0166325ef 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/uspGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts @@ -1,14 +1,13 @@ import { z } from "zod" +import { BlocksEnums } from "../../../../types/blocks" +import { UspGridEnum } from "../../../../types/uspGrid" import { linkRefsUnionSchema, linkUnionSchema, transformPageLink, } from "../pageLinks" -import { BlocksEnums } from "@/types/enums/blocks" -import { UspGridEnum } from "@/types/enums/uspGrid" - const uspCardSchema = z.object({ icon: UspGridEnum.uspIcons, text: z.object({ diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/utils/buttonLinkSchema.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/utils/buttonLinkSchema.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/utils/buttonLinkSchema.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/utils/buttonLinkSchema.ts diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/utils/linkConnection.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/schemas/blocks/utils/linkConnection.ts rename to packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts diff --git a/apps/scandic-web/server/routers/contentstack/schemas/headers/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts similarity index 78% rename from apps/scandic-web/server/routers/contentstack/schemas/headers/dynamicContent.ts rename to packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts index a5be16dfa..e5e24eb13 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/headers/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" +import { DynamicContentEnum } from "../../../../types/dynamicContent" export const dynamicContentSchema = z.object({ component: z.enum(DynamicContentEnum.Headers.enums).nullish(), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/imageVault.ts b/packages/trpc/lib/routers/contentstack/schemas/imageVault.ts similarity index 91% rename from apps/scandic-web/server/routers/contentstack/schemas/imageVault.ts rename to packages/trpc/lib/routers/contentstack/schemas/imageVault.ts index 244992d12..a824858c7 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/imageVault.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/imageVault.ts @@ -1,6 +1,8 @@ import { z } from "zod" -import { makeImageVaultImage } from "@/utils/imageVault" +import { insertResponseToImageVaultAsset } from "../../../utils/imageVault" + +import type { ImageVaultAssetResponse } from "../../../types/imageVault" const metaData = z.object({ DefinitionType: z.number().nullable().optional(), @@ -153,3 +155,9 @@ export const tempImageVaultAssetSchema = imageVaultAssetSchema } return undefined }) + +function makeImageVaultImage(image: any) { + return image && !!Object.keys(image).length + ? insertResponseToImageVaultAsset(image as ImageVaultAssetResponse) + : undefined +} diff --git a/apps/scandic-web/server/routers/contentstack/schemas/linkConnection.ts b/packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/schemas/linkConnection.ts rename to packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts diff --git a/apps/scandic-web/server/routers/contentstack/schemas/mapLocation.ts b/packages/trpc/lib/routers/contentstack/schemas/mapLocation.ts similarity index 100% rename from apps/scandic-web/server/routers/contentstack/schemas/mapLocation.ts rename to packages/trpc/lib/routers/contentstack/schemas/mapLocation.ts diff --git a/apps/scandic-web/server/routers/contentstack/schemas/pageLinks.ts b/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts similarity index 98% rename from apps/scandic-web/server/routers/contentstack/schemas/pageLinks.ts rename to packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts index f57fe9c66..1e87e0ac0 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/pageLinks.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts @@ -1,11 +1,10 @@ import { z } from "zod" -import { removeMultipleSlashes } from "@/utils/url" +import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" +import { ContentEnum } from "../../../types/content" import { systemSchema } from "./system" -import { ContentEnum } from "@/types/enums/content" - export const pageLinkSchema = z.object({ system: systemSchema, title: z.string().optional().default(""), diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/content.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/content.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts index 9d287d5f0..7856b2646 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/content.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts @@ -1,5 +1,7 @@ import { z } from "zod" +import { ContentEnum } from "../../../../types/content" +import { SidebarEnums } from "../../../../types/sidebar" import { imageContainerRefsSchema, imageContainerSchema, @@ -11,9 +13,6 @@ import { transformPageLink, } from "../pageLinks" -import { ContentEnum } from "@/types/enums/content" -import { SidebarEnums } from "@/types/enums/sidebar" - export const contentSchema = z.object({ typename: z .literal(SidebarEnums.blocks.Content) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/dynamicContent.ts similarity index 70% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/dynamicContent.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/dynamicContent.ts index c52a395a3..a4fba3a89 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/dynamicContent.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { DynamicContentEnum } from "@/types/enums/dynamicContent" -import { SidebarEnums } from "@/types/enums/sidebar" +import { DynamicContentEnum } from "../../../../types/dynamicContent" +import { SidebarEnums } from "../../../../types/sidebar" export const dynamicContentSchema = z.object({ typename: z diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts similarity index 92% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts index ae565b8a9..39c28197a 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts @@ -1,11 +1,10 @@ import { z } from "zod" +import { JoinLoyaltyContactEnums } from "../../../../types/joinLoyaltyContact" +import { SidebarEnums } from "../../../../types/sidebar" import { buttonSchema } from "../blocks/utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "../blocks/utils/linkConnection" -import { JoinLoyaltyContactEnums } from "@/types/enums/joinLoyaltyContact" -import { SidebarEnums } from "@/types/enums/sidebar" - export const contactSchema = z.object({ contact: z.array( z diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/quickLinks.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts similarity index 86% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/quickLinks.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts index 0ea77453e..b45c4cc86 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/quickLinks.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts @@ -1,9 +1,8 @@ import { z } from "zod" +import { SidebarEnums } from "../../../../types/sidebar" import { shortcutsBlockSchema, shortcutsRefsSchema } from "../blocks/shortcuts" -import { SidebarEnums } from "@/types/enums/sidebar" - export const quickLinksSchema = z .object({ typename: z diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/scriptedCard.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts similarity index 90% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/scriptedCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts index a391f4bc0..7cb5af66b 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/scriptedCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts @@ -1,5 +1,7 @@ import { z } from "zod" +import { scriptedCardThemeEnum } from "../../../../enums/scriptedCard" +import { SidebarEnums } from "../../../../types/sidebar" import { cardBlockRefsSchema, cardBlockSchema, @@ -7,9 +9,6 @@ import { transformCardBlockRefs, } from "../blocks/cardsGrid" -import { scriptedCardThemeEnum } from "@/types/enums/scriptedCard" -import { SidebarEnums } from "@/types/enums/sidebar" - export const scriptedCardsSchema = z.object({ typename: z .literal(SidebarEnums.blocks.ScriptedCard) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/teaserCard.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/schemas/sidebar/teaserCard.ts rename to packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts index c0cfde027..94816d149 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/sidebar/teaserCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { SidebarEnums } from "../../../../types/sidebar" import { teaserCardBlockRefsSchema, teaserCardBlockSchema, @@ -7,8 +8,6 @@ import { } from "../blocks/cards/teaserCard" import { transformCardBlockRefs } from "../blocks/cardsGrid" -import { SidebarEnums } from "@/types/enums/sidebar" - export const teaserCardsSchema = z.object({ typename: z .literal(SidebarEnums.blocks.TeaserCard) diff --git a/apps/scandic-web/server/routers/contentstack/schemas/system.ts b/packages/trpc/lib/routers/contentstack/schemas/system.ts similarity index 75% rename from apps/scandic-web/server/routers/contentstack/schemas/system.ts rename to packages/trpc/lib/routers/contentstack/schemas/system.ts index e86afd1e4..732f48ad8 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/system.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/system.ts @@ -7,3 +7,7 @@ export const systemSchema = z.object({ locale: z.nativeEnum(Lang), uid: z.string(), }) + +export interface System { + system: z.output +} diff --git a/apps/scandic-web/server/routers/contentstack/startPage/index.ts b/packages/trpc/lib/routers/contentstack/startPage/index.ts similarity index 68% rename from apps/scandic-web/server/routers/contentstack/startPage/index.ts rename to packages/trpc/lib/routers/contentstack/startPage/index.ts index 3838da32f..805d1ec35 100644 --- a/apps/scandic-web/server/routers/contentstack/startPage/index.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../../.." import { startPageQueryRouter } from "./query" export const startPageRouter = mergeRouters(startPageQueryRouter) diff --git a/apps/scandic-web/server/routers/contentstack/startPage/output.ts b/packages/trpc/lib/routers/contentstack/startPage/output.ts similarity index 95% rename from apps/scandic-web/server/routers/contentstack/startPage/output.ts rename to packages/trpc/lib/routers/contentstack/startPage/output.ts index 3a330ab0d..81c4d9888 100644 --- a/apps/scandic-web/server/routers/contentstack/startPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/output.ts @@ -1,7 +1,6 @@ import { z } from "zod" -import { discriminatedUnionArray } from "@/lib/discriminatedUnion" - +import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { cardGridRefsSchema, cardsGridSchema, @@ -20,8 +19,7 @@ import { } from "../schemas/blocks/joinScandicFriends" import { tempImageVaultAssetSchema } from "../schemas/imageVault" import { systemSchema } from "../schemas/system" - -import { StartPageEnum } from "@/types/enums/startPage" +import { StartPageEnum } from "./utils" const startPageCards = z .object({ diff --git a/apps/scandic-web/server/routers/contentstack/startPage/query.ts b/packages/trpc/lib/routers/contentstack/startPage/query.ts similarity index 77% rename from apps/scandic-web/server/routers/contentstack/startPage/query.ts rename to packages/trpc/lib/routers/contentstack/startPage/query.ts index bc56125ad..9d6410c48 100644 --- a/apps/scandic-web/server/routers/contentstack/startPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/query.ts @@ -1,31 +1,33 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" +import { router } from "../../.." +import { notFound } from "../../../errors" import { GetStartPage, GetStartPageRefs, -} from "@/lib/graphql/Query/StartPage/StartPage.graphql" -import { request } from "@/lib/graphql/request" - +} from "../../../graphql/Query/StartPage/StartPage.graphql" +import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { generateRefsResponseTag, generateTag, generateTagsFromSystem, -} from "@/utils/generateTag" - +} from "../../../utils/generateTag" import { startPageRefsSchema, startPageSchema } from "./output" import { getConnections } from "./utils" -import { - TrackingChannelEnum, - type TrackingSDKPageData, -} from "@/types/components/tracking" -import type { - GetStartPageData, - GetStartPageRefsSchema, -} from "@/types/trpc/routers/contentstack/startPage" +import type { z } from "zod" + +import type { TrackingPageData } from "../../types" +import type { blocksSchema } from "./output" + +export interface GetStartPageData extends z.input {} +export interface StartPage extends z.output {} + +export interface GetStartPageRefsSchema + extends z.input {} + +export type Block = z.output export const startPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { @@ -108,11 +110,11 @@ export const startPageQueryRouter = router({ metricsGetStartPage.success() const system = startPage.data.start_page.system - const tracking: TrackingSDKPageData = { + const tracking: TrackingPageData = { pageName: "startpage", pageType: "startpage", pageId: system.uid, - channel: TrackingChannelEnum["homepage"], + channel: "homepage", domainLanguage: lang, createDate: system.created_at, publishDate: system.updated_at, diff --git a/apps/scandic-web/server/routers/contentstack/startPage/utils.ts b/packages/trpc/lib/routers/contentstack/startPage/utils.ts similarity index 50% rename from apps/scandic-web/server/routers/contentstack/startPage/utils.ts rename to packages/trpc/lib/routers/contentstack/startPage/utils.ts index 9edb0720e..2f72c3576 100644 --- a/apps/scandic-web/server/routers/contentstack/startPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/utils.ts @@ -1,6 +1,20 @@ -import { StartPageEnum } from "@/types/enums/startPage" -import type { System } from "@/types/requests/system" -import type { StartPageRefs } from "@/types/trpc/routers/contentstack/startPage" +import type { z } from "zod" + +import type { System } from "../schemas/system" +import type { startPageRefsSchema } from "./output" + +export namespace StartPageEnum { + export namespace ContentStack { + export const enum blocks { + CardsGrid = "StartPageBlocksCardsGrid", + CarouselCards = "StartPageBlocksCarouselCards", + FullWidthCampaign = "StartPageBlocksFullWidthCampaign", + JoinScandicFriends = "StartPageBlocksJoinScandicFriends", + } + } +} + +export interface StartPageRefs extends z.output {} export function getConnections({ start_page }: StartPageRefs) { const connections: System["system"][] = [start_page.system] diff --git a/apps/scandic-web/server/routers/hotels/input.ts b/packages/trpc/lib/routers/hotels/input.ts similarity index 96% rename from apps/scandic-web/server/routers/hotels/input.ts rename to packages/trpc/lib/routers/hotels/input.ts index 9241f5aa7..9e3412009 100644 --- a/apps/scandic-web/server/routers/hotels/input.ts +++ b/packages/trpc/lib/routers/hotels/input.ts @@ -3,10 +3,10 @@ import { z } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" -import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { Country } from "@/types/enums/country" +import { BreakfastPackageEnum } from "../../enums/breakfast" +import { ChildBedMapEnum } from "../../enums/childBedMapEnum" +import { RoomPackageCodeEnum } from "../../enums/roomFilter" +import { Country } from "../../types/country" export const hotelsAvailabilityInputSchema = z .object({ diff --git a/apps/scandic-web/server/routers/hotels/output.ts b/packages/trpc/lib/routers/hotels/output.ts similarity index 96% rename from apps/scandic-web/server/routers/hotels/output.ts rename to packages/trpc/lib/routers/hotels/output.ts index 6cba530f9..eee41e74f 100644 --- a/apps/scandic-web/server/routers/hotels/output.ts +++ b/packages/trpc/lib/routers/hotels/output.ts @@ -1,10 +1,18 @@ import { z } from "zod" -import { toLang } from "@/server/utils" - -import { sortRoomConfigs } from "@/utils/sort" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { toLang } from "@scandic-hotels/common/utils/languages" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" +import { RateEnum } from "../../enums/rate" +import { RateTypeEnum } from "../../enums/rateType" +import { RoomPackageCodeEnum } from "../../enums/roomFilter" +import { AvailabilityEnum } from "../../enums/selectHotel" +import { + ancillaryPackageSchema, + breakfastPackageSchema, + packageSchema, +} from "../../routers/hotels/schemas/packages" +import { sortRoomConfigs } from "../../utils/sortRoomConfigs" import { occupancySchema } from "./schemas/availability/occupancy" import { productTypeSchema } from "./schemas/availability/productType" import { citySchema } from "./schemas/city" @@ -19,30 +27,18 @@ import { locationSchema } from "./schemas/hotel/location" import { imageSchema } from "./schemas/image" import { locationCitySchema } from "./schemas/location/city" import { locationHotelSchema } from "./schemas/location/hotel" -import { - ancillaryPackageSchema, - breakfastPackageSchema, - packageSchema, -} from "./schemas/packages" import { relationshipsSchema } from "./schemas/relationships" import { roomConfigurationSchema } from "./schemas/roomAvailability/configuration" import { rateDefinitionSchema } from "./schemas/roomAvailability/rateDefinition" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { RateEnum } from "@/types/enums/rate" -import { RateTypeEnum } from "@/types/enums/rateType" import type { AdditionalData, City, NearbyHotel, Restaurant, Room, -} from "@/types/hotel" -import type { - Product, - RateDefinition, -} from "@/types/trpc/routers/hotel/roomAvailability" +} from "../../types/hotel" +import type { Product, RateDefinition } from "../../types/roomAvailability" // NOTE: Find schema at: https://aks-test.scandichotels.com/hotel/swagger/v1/index.html export const hotelSchema = z diff --git a/apps/scandic-web/server/routers/hotels/schemas/availability/occupancy.ts b/packages/trpc/lib/routers/hotels/schemas/availability/occupancy.ts similarity index 78% rename from apps/scandic-web/server/routers/hotels/schemas/availability/occupancy.ts rename to packages/trpc/lib/routers/hotels/schemas/availability/occupancy.ts index c9b26924f..826377f20 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/availability/occupancy.ts +++ b/packages/trpc/lib/routers/hotels/schemas/availability/occupancy.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { ChildBedTypeEnum } from "@/constants/booking" +import { ChildBedTypeEnum } from "../../../../enums/childBedTypeEnum" export const childrenSchema = z.object({ age: z.number(), diff --git a/apps/scandic-web/server/routers/hotels/schemas/availability/productType.ts b/packages/trpc/lib/routers/hotels/schemas/availability/productType.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/availability/productType.ts rename to packages/trpc/lib/routers/hotels/schemas/availability/productType.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/city.ts b/packages/trpc/lib/routers/hotels/schemas/city.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/city.ts rename to packages/trpc/lib/routers/hotels/schemas/city.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel.ts b/packages/trpc/lib/routers/hotels/schemas/hotel.ts similarity index 89% rename from apps/scandic-web/server/routers/hotels/schemas/hotel.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel.ts index 13d91036c..e537ffb84 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel.ts @@ -3,9 +3,9 @@ import { z } from "zod" import { nullableArrayObjectValidator, nullableArrayStringValidator, -} from "@/utils/zod/arrayValidator" -import { nullableNumberValidator } from "@/utils/zod/numberValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +} from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableNumberValidator } from "@scandic-hotels/common/utils/zod/numberValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" import { addressSchema } from "./hotel/address" import { contactInformationSchema } from "./hotel/contactInformation" @@ -13,7 +13,7 @@ import { hotelContentSchema } from "./hotel/content" import { detailedFacilitiesSchema } from "./hotel/detailedFacility" import { hotelFactsSchema } from "./hotel/facts" import { healthFacilitiesSchema } from "./hotel/healthFacilities" -import { includeSchema } from "./hotel/include/include" +import { includeSchema } from "./hotel/include" import { locationSchema } from "./hotel/location" import { merchantInformationSchema } from "./hotel/merchantInformation" import { parkingSchema } from "./hotel/parking" diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/address.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/address.ts similarity index 70% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/address.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/address.ts index e97039ec9..fdeffe91f 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/address.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/address.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const addressSchema = z.object({ city: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/contactInformation.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/contactInformation.ts similarity index 83% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/contactInformation.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/contactInformation.ts index 8ea56e7af..8ed9e3f57 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/contactInformation.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/contactInformation.ts @@ -3,7 +3,7 @@ import { z } from "zod" import { nullableStringEmailValidator, nullableStringValidator, -} from "@/utils/zod/stringValidator" +} from "@scandic-hotels/common/utils/zod/stringValidator" export const contactInformationSchema = z.object({ email: nullableStringEmailValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/content.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/content.ts similarity index 84% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/content.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/content.ts index 8660c14af..281c99b8c 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/content.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/content.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" import { imageSchema } from "../image" diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/detailedFacility.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/detailedFacility.ts similarity index 76% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/detailedFacility.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/detailedFacility.ts index c7c367159..ba646e6cd 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/detailedFacility.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/detailedFacility.ts @@ -1,10 +1,10 @@ import slugify from "slugify" import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { FacilityEnum } from "@/types/enums/facilities" +import { FacilityEnum } from "../../../../enums/facilities" const rawDetailedFacilitySchema = z.object({ filter: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/facts.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/facts.ts similarity index 92% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/facts.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/facts.ts index 6ccbcd815..f2593324e 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/facts.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/facts.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const checkinSchema = z.object({ checkInTime: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/healthFacilities.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/healthFacilities.ts similarity index 84% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/healthFacilities.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/healthFacilities.ts index 058fa36dd..14a343bf1 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/healthFacilities.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/healthFacilities.ts @@ -1,8 +1,8 @@ import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableNumberValidator } from "@/utils/zod/numberValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableNumberValidator } from "@scandic-hotels/common/utils/zod/numberValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" import { imageSchema } from "../image" diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/include.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts similarity index 64% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/include.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include.ts index d447f8729..65bce9681 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/include.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include.ts @@ -1,14 +1,16 @@ import { z } from "zod" -import { citySchema } from "@/server/routers/hotels/schemas/city" -import { nearbyHotelsSchema } from "@/server/routers/hotels/schemas/hotel/include/nearbyHotels" -import { restaurantsSchema } from "@/server/routers/hotels/schemas/hotel/include/restaurants" +import { citySchema } from "../city" +import { + additionalDataSchema, + transformAdditionalData, +} from "./include/additionalData" +import { nearbyHotelsSchema } from "./include/nearbyHotels" +import { restaurantsSchema } from "./include/restaurants" import { roomCategoriesSchema, transformRoomCategories, -} from "@/server/routers/hotels/schemas/hotel/include/roomCategories" - -import { additionalDataSchema, transformAdditionalData } from "./additionalData" +} from "./include/roomCategories" export const includeSchema = z .union([ diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData.ts similarity index 90% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData.ts index 3b2ff6a60..54e325521 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" import { displayWebPageSchema } from "./additionalData/displayWebPage" import { facilitySchema } from "./additionalData/facility" diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/displayWebPage.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/displayWebPage.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/displayWebPage.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/displayWebPage.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/facility.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/facility.ts similarity index 61% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/facility.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/facility.ts index 33af0bd70..a040582ec 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/facility.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/facility.ts @@ -1,8 +1,8 @@ import { z } from "zod" -import { imageSchema } from "@/server/routers/hotels/schemas/image" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { imageSchema } from "../../../image" export const facilitySchema = z.object({ headingText: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/gallery.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/gallery.ts similarity index 78% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/gallery.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/gallery.ts index 6ead41c53..5c56f95b2 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/gallery.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/gallery.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { imageSchema } from "@/server/routers/hotels/schemas/image" +import { imageSchema } from "../../../image" const imagesSchema = z .array(imageSchema) diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts similarity index 78% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts index 5478dac90..2d9d622f4 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/restaurantsOverviewPage.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const restaurantsOverviewPageSchema = z.object({ restaurantsContentDescriptionMedium: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts similarity index 60% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts index c0e6aa372..b7c202c52 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/additionalData/specialNeedGroups.ts @@ -1,7 +1,7 @@ import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" const specialNeedSchema = z.object({ details: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/nearbyHotels.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts similarity index 85% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/nearbyHotels.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts index e1d837464..7b37c4e7b 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/nearbyHotels.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/nearbyHotels.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { attributesSchema } from "@/server/routers/hotels/schemas/hotel" +import { attributesSchema } from "../../hotel" export const nearbyHotelsSchema = z.object({ attributes: z.lazy(() => diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/restaurants.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts similarity index 92% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/restaurants.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts index 0fe973620..61888fc24 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/restaurants.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/restaurants.ts @@ -1,20 +1,18 @@ import { z } from "zod" -import { imageSchema } from "@/server/routers/hotels/schemas/image" - +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { nullableIntValidator, nullableNumberValidator, -} from "@/utils/zod/numberValidator" +} from "@scandic-hotels/common/utils/zod/numberValidator" import { nullableStringUrlValidator, nullableStringValidator, -} from "@/utils/zod/stringValidator" +} from "@scandic-hotels/common/utils/zod/stringValidator" +import { imageSchema } from "../../image" import { specialAlertsSchema } from "../specialAlerts" -import { CurrencyEnum } from "@/types/enums/currency" - const descriptionSchema = z.object({ medium: nullableStringValidator, short: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/roomCategories.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/include/roomCategories.ts similarity index 92% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/include/roomCategories.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/include/roomCategories.ts index c6bf7cdb9..01e8a778e 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/include/roomCategories.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/include/roomCategories.ts @@ -1,9 +1,9 @@ import { z } from "zod" -import { imageSchema } from "@/server/routers/hotels/schemas/image" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { imageSchema } from "../../image" const minMaxSchema = z.object({ max: z.number(), diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/location.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/location.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/location.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/location.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/merchantInformation.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/merchantInformation.ts similarity index 77% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/merchantInformation.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/merchantInformation.ts index b3b6df11b..2543a3aac 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/merchantInformation.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/merchantInformation.ts @@ -1,8 +1,8 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import type { PaymentMethodEnum } from "@/constants/booking" +import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" export const merchantInformationSchema = z.object({ alternatePaymentOptions: z diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/parking.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/parking.ts similarity index 80% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/parking.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/parking.ts index b4ca7bb90..a42a073f4 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/parking.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/parking.ts @@ -1,8 +1,8 @@ import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" -import { nullableNumberValidator } from "@/utils/zod/numberValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" +import { nullableNumberValidator } from "@scandic-hotels/common/utils/zod/numberValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" const periodSchema = z.object({ amount: nullableNumberValidator, diff --git a/packages/trpc/lib/routers/hotels/schemas/hotel/poi.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/poi.ts new file mode 100644 index 000000000..5d184ee69 --- /dev/null +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/poi.ts @@ -0,0 +1,63 @@ +import { z } from "zod" + +import { nullableNumberValidator } from "@scandic-hotels/common/utils/zod/numberValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" + +import { PointOfInterestGroupEnum } from "../../../../enums/pointOfInterest" +import { locationSchema } from "./location" + +export const pointOfInterestSchema = z + .object({ + category: z.object({ + name: nullableStringValidator, + }), + distance: nullableNumberValidator, + location: locationSchema, + name: nullableStringValidator, + }) + .transform((poi) => ({ + categoryName: poi.category.name, + coordinates: { + lat: poi.location.latitude, + lng: poi.location.longitude, + }, + distance: poi.distance, + group: getPoiGroupByCategoryName(poi.category.name), + name: poi.name, + })) + +export const pointOfInterestsSchema = z + .array(pointOfInterestSchema) + .nullish() + .transform((arr) => (arr ? arr.filter(Boolean) : [])) + .transform((pois) => + pois.sort((a, b) => (a.distance ?? 0) - (b.distance ?? 0)) + ) + +function getPoiGroupByCategoryName(category: string | undefined) { + if (!category) return PointOfInterestGroupEnum.LOCATION + switch (category) { + case "Airport": + case "Bus terminal": + case "Transportations": + return PointOfInterestGroupEnum.PUBLIC_TRANSPORT + case "Amusement park": + case "Museum": + case "Sports": + case "Theatre": + case "Tourist": + case "Zoo": + return PointOfInterestGroupEnum.ATTRACTIONS + case "Nearby companies": + case "Fair": + return PointOfInterestGroupEnum.BUSINESS + case "Parking / Garage": + return PointOfInterestGroupEnum.PARKING + case "Shopping": + case "Restaurant": + return PointOfInterestGroupEnum.SHOPPING_DINING + case "Hospital": + default: + return PointOfInterestGroupEnum.LOCATION + } +} diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/rating.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/rating.ts similarity index 88% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/rating.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/rating.ts index 29066e1f5..4f399d3dc 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/rating.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/rating.ts @@ -1,10 +1,10 @@ import { z } from "zod" -import { nullableArrayObjectValidator } from "@/utils/zod/arrayValidator" +import { nullableArrayObjectValidator } from "@scandic-hotels/common/utils/zod/arrayValidator" import { nullableStringUrlValidator, nullableStringValidator, -} from "@/utils/zod/stringValidator" +} from "@scandic-hotels/common/utils/zod/stringValidator" const awardSchema = z.object({ displayName: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/rewardNight.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/rewardNight.ts similarity index 70% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/rewardNight.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/rewardNight.ts index 4640cf275..b6ae6ae3c 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/rewardNight.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/rewardNight.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const rewardNightSchema = z.object({ campaign: z.object({ diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/socialMedia.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/socialMedia.ts similarity index 61% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/socialMedia.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/socialMedia.ts index 18217579e..0c539eea2 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/socialMedia.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/socialMedia.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const socialMediaSchema = z.object({ facebook: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/hotel/specialAlerts.ts b/packages/trpc/lib/routers/hotels/schemas/hotel/specialAlerts.ts similarity index 85% rename from apps/scandic-web/server/routers/hotels/schemas/hotel/specialAlerts.ts rename to packages/trpc/lib/routers/hotels/schemas/hotel/specialAlerts.ts index c23f81f7a..b182cafbe 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/hotel/specialAlerts.ts +++ b/packages/trpc/lib/routers/hotels/schemas/hotel/specialAlerts.ts @@ -1,10 +1,9 @@ import { z } from "zod" -import { dt } from "@/lib/dt" +import { dt } from "@scandic-hotels/common/dt" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" - -import { AlertTypeEnum } from "@/types/enums/alert" +import { AlertTypeEnum } from "../../../../types/alertType" const specialAlertSchema = z.object({ description: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/image.ts b/packages/trpc/lib/routers/hotels/schemas/image.ts similarity index 91% rename from apps/scandic-web/server/routers/hotels/schemas/image.ts rename to packages/trpc/lib/routers/hotels/schemas/image.ts index 444541e76..35ca86354 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/image.ts +++ b/packages/trpc/lib/routers/hotels/schemas/image.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const imageSizesSchema = z.object({ large: nullableStringValidator, diff --git a/apps/scandic-web/server/routers/hotels/schemas/location/city.ts b/packages/trpc/lib/routers/hotels/schemas/location/city.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/location/city.ts rename to packages/trpc/lib/routers/hotels/schemas/location/city.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/location/hotel.ts b/packages/trpc/lib/routers/hotels/schemas/location/hotel.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/location/hotel.ts rename to packages/trpc/lib/routers/hotels/schemas/location/hotel.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/packages.ts b/packages/trpc/lib/routers/hotels/schemas/packages.ts similarity index 86% rename from apps/scandic-web/server/routers/hotels/schemas/packages.ts rename to packages/trpc/lib/routers/hotels/schemas/packages.ts index 9978f8114..83ebe03cc 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/packages.ts +++ b/packages/trpc/lib/routers/hotels/schemas/packages.ts @@ -1,11 +1,11 @@ import { z } from "zod" -import { imageSizesSchema } from "./image" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" -import { BreakfastPackageEnum } from "@/types/enums/breakfast" -import { CurrencyEnum } from "@/types/enums/currency" -import { PackageTypeEnum } from "@/types/enums/packages" +import { BreakfastPackageEnum } from "../../../enums/breakfast" +import { PackageTypeEnum } from "../../../enums/packages" +import { RoomPackageCodeEnum } from "../../../enums/roomFilter" +import { imageSizesSchema } from "./image" // TODO: Remove optional and default when the API change has been deployed export const packagePriceSchema = z diff --git a/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts b/packages/trpc/lib/routers/hotels/schemas/productTypePrice.ts similarity index 87% rename from apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts rename to packages/trpc/lib/routers/hotels/schemas/productTypePrice.ts index 98e3de49f..c6e5bb790 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts +++ b/packages/trpc/lib/routers/hotels/schemas/productTypePrice.ts @@ -1,10 +1,10 @@ import { z } from "zod" -import { nullableNumberValidator } from "@/utils/zod/numberValidator" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" +import { nullableNumberValidator } from "@scandic-hotels/common/utils/zod/numberValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { CurrencyEnum } from "@/types/enums/currency" -import { RateTypeEnum } from "@/types/enums/rateType" +import { RateTypeEnum } from "../../../enums/rateType" export const corporateChequeSchema = z .object({ diff --git a/apps/scandic-web/server/routers/hotels/schemas/relationships.ts b/packages/trpc/lib/routers/hotels/schemas/relationships.ts similarity index 100% rename from apps/scandic-web/server/routers/hotels/schemas/relationships.ts rename to packages/trpc/lib/routers/hotels/schemas/relationships.ts diff --git a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/configuration.ts b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/configuration.ts similarity index 87% rename from apps/scandic-web/server/routers/hotels/schemas/roomAvailability/configuration.ts rename to packages/trpc/lib/routers/hotels/schemas/roomAvailability/configuration.ts index b154d89a4..61c688afc 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/configuration.ts +++ b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/configuration.ts @@ -1,5 +1,7 @@ import { z } from "zod" +import { RoomPackageCodeEnum } from "../../../../enums/roomFilter" +import { AvailabilityEnum } from "../../../../enums/selectHotel" import { corporateChequeProduct, priceProduct, @@ -8,9 +10,6 @@ import { voucherProduct, } from "./product" -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" - export const roomConfigurationSchema = z.object({ breakfastIncludedInAllRatesMember: z.boolean().default(false), breakfastIncludedInAllRates: z.boolean().default(false), diff --git a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/product.ts b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/product.ts similarity index 98% rename from apps/scandic-web/server/routers/hotels/schemas/roomAvailability/product.ts rename to packages/trpc/lib/routers/hotels/schemas/roomAvailability/product.ts index 7b9fc3d3c..825bdd41c 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/product.ts +++ b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/product.ts @@ -1,5 +1,6 @@ import { z } from "zod" +import { RateEnum } from "../../../../enums/rate" import { productTypeCorporateChequeSchema, productTypePointsSchema, @@ -8,8 +9,6 @@ import { } from "../productTypePrice" import { rateDefinitionSchema } from "./rateDefinition" -import { RateEnum } from "@/types/enums/rate" - const baseProductSchema = z.object({ // transform empty string to undefined bookingCode: z diff --git a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/rateDefinition.ts b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/rateDefinition.ts similarity index 85% rename from apps/scandic-web/server/routers/hotels/schemas/roomAvailability/rateDefinition.ts rename to packages/trpc/lib/routers/hotels/schemas/roomAvailability/rateDefinition.ts index 2703dea7a..f65350c30 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/roomAvailability/rateDefinition.ts +++ b/packages/trpc/lib/routers/hotels/schemas/roomAvailability/rateDefinition.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { nullableStringValidator } from "@/utils/zod/stringValidator" +import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" export const rateDefinitionSchema = z.object({ breakfastIncluded: z.boolean(), diff --git a/packages/trpc/lib/routers/hotels/utils.ts b/packages/trpc/lib/routers/hotels/utils.ts new file mode 100644 index 000000000..c03919e51 --- /dev/null +++ b/packages/trpc/lib/routers/hotels/utils.ts @@ -0,0 +1,596 @@ +import deepmerge from "deepmerge" + +import { Lang } from "@scandic-hotels/common/constants/language" +import { getCacheClient } from "@scandic-hotels/common/dataCache" +import { createCounter } from "@scandic-hotels/common/telemetry" +import { chunk } from "@scandic-hotels/common/utils/chunk" + +import { env } from "../../../env/server" +import * as api from "../../api" +import { cache } from "../../DUPLICATED/cache" +import { HotelTypeEnum } from "../../enums/hotelType" +import { badRequestError } from "../../errors" +import { toApiLang } from "../../utils" +import { getHotelPageUrls } from "../contentstack/hotelPage/utils" +import { + citiesByCountrySchema, + citiesSchema, + countriesSchema, + getHotelIdsSchema, + hotelSchema, + locationsSchema, +} from "./output" + +import type { z } from "zod" + +import type { Endpoint } from "../../api/endpoints" +import type { DestinationPagesHotelData, HotelInput } from "../../types/hotel" +import type { + CitiesGroupedByCountry, + CityLocation, +} from "../../types/locations" +import type { Cities } from "./output" + +export const locationsAffix = "locations" + +export async function getCitiesByCountry({ + countries, + lang, + affix = locationsAffix, + serviceToken, +}: { + countries: string[] + lang: Lang + affix?: string + serviceToken: string +}): Promise { + const cacheClient = await getCacheClient() + const allCitiesByCountries = await Promise.all( + countries.map(async (country) => { + return cacheClient.cacheOrGet( + `${lang}:${affix}:cities-by-country:${country}`, + async () => { + const params = new URLSearchParams({ + language: toApiLang(lang), + }) + const countryResponse = await api.get( + api.endpoints.v1.Hotel.Cities.country(country), + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + params + ) + + if (!countryResponse.ok) { + throw new Error(`Unable to fetch cities by country ${country}`) + } + + const countryJson = await countryResponse.json() + const citiesByCountry = citiesByCountrySchema.safeParse(countryJson) + if (!citiesByCountry.success) { + console.error(`Unable to parse cities by country ${country}`) + console.error(citiesByCountry.error) + throw new Error(`Unable to parse cities by country ${country}`) + } + return { ...citiesByCountry.data, country } + }, + "1d" + ) + }) + ) + + const filteredCitiesByCountries = allCitiesByCountries.map((country) => ({ + ...country, + data: country.data.filter((city) => city.isPublished), + })) + + const groupedCitiesByCountry: CitiesGroupedByCountry = + filteredCitiesByCountries.reduce((acc, { country, data }) => { + acc[country] = data + return acc + }, {} as CitiesGroupedByCountry) + + return groupedCitiesByCountry +} + +export async function getCountries({ + lang, + serviceToken, + warmup = false, +}: { + lang: Lang + serviceToken: string + warmup?: boolean +}) { + const cacheClient = await getCacheClient() + return await cacheClient.cacheOrGet( + `${lang}:${locationsAffix}:countries`, + async () => { + const params = new URLSearchParams({ + language: toApiLang(lang), + }) + + const countryResponse = await api.get( + api.endpoints.v1.Hotel.countries, + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + params + ) + + if (!countryResponse.ok) { + throw new Error("Unable to fetch countries") + } + + const countriesJson = await countryResponse.json() + const countries = countriesSchema.safeParse(countriesJson) + if (!countries.success) { + console.info(`Validation for countries failed`) + console.error(countries.error) + return null + } + + return countries.data + }, + "1d", + { + cacheStrategy: warmup ? "fetch-then-cache" : "cache-first", + } + ) +} + +export async function getHotelIdsByCityId({ + cityId, + serviceToken, +}: { + cityId: string + serviceToken: string +}) { + const getHotelIdsByCityIdCounter = createCounter( + "hotel", + "getHotelIdsByCityId" + ) + const metricsGetHotelIdsByCityId = getHotelIdsByCityIdCounter.init({ + cityId, + }) + + metricsGetHotelIdsByCityId.start() + + const cacheClient = await getCacheClient() + const result = await cacheClient.cacheOrGet( + `${cityId}:hotelsByCityId`, + async () => { + const searchParams = new URLSearchParams({ + city: cityId, + }) + + const apiResponse = await api.get( + api.endpoints.v1.Hotel.hotels, + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + searchParams + ) + + if (!apiResponse.ok) { + await metricsGetHotelIdsByCityId.httpError(apiResponse) + throw new Error("Unable to fetch hotelIds by cityId") + } + + const apiJson = await apiResponse.json() + const validatedHotelIds = getHotelIdsSchema.safeParse(apiJson) + if (!validatedHotelIds.success) { + metricsGetHotelIdsByCityId.validationError(validatedHotelIds.error) + throw new Error("Unable to parse data for hotelIds by cityId") + } + + return validatedHotelIds.data + }, + env.CACHE_TIME_HOTELS + ) + + metricsGetHotelIdsByCityId.success() + + return result +} + +export async function getCityByCityIdentifier({ + cityIdentifier, + lang, + serviceToken, +}: { + cityIdentifier: string + lang: Lang + serviceToken: string +}) { + const locations = await getLocations({ + lang, + citiesByCountry: null, + serviceToken, + }) + if (!locations || "error" in locations) { + return null + } + + const city = locations + .filter((loc): loc is CityLocation => loc.type === "cities") + .find((loc) => loc.cityIdentifier === cityIdentifier) + + return city ?? null +} + +export async function getHotelIdsByCityIdentifier( + cityIdentifier: string, + serviceToken: string +) { + const city = await getCityByCityIdentifier({ + cityIdentifier, + lang: Lang.en, + serviceToken, + }) + + if (!city) { + return [] + } + + const hotelIds = await getHotelIdsByCityId({ + cityId: city.id, + serviceToken, + }) + return hotelIds +} + +export async function getHotelIdsByCountry({ + country, + serviceToken, +}: { + country: string + serviceToken: string +}) { + const getHotelIdsByCountryCounter = createCounter( + "hotel", + "getHotelIdsByCountry" + ) + + const metricsGetHotelIdsByCountry = getHotelIdsByCountryCounter.init({ + country, + }) + + metricsGetHotelIdsByCountry.start() + + const cacheClient = await getCacheClient() + + const result = await cacheClient.cacheOrGet( + `${country}:hotelsByCountry`, + async () => { + const hotelIdsParams = new URLSearchParams({ + country, + }) + + const apiResponse = await api.get( + api.endpoints.v1.Hotel.hotels, + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + hotelIdsParams + ) + + if (!apiResponse.ok) { + await metricsGetHotelIdsByCountry.httpError(apiResponse) + throw new Error("Unable to fetch hotelIds by country") + } + + const apiJson = await apiResponse.json() + const validatedHotelIds = getHotelIdsSchema.safeParse(apiJson) + if (!validatedHotelIds.success) { + metricsGetHotelIdsByCountry.validationError(validatedHotelIds.error) + throw new Error("Unable to parse hotelIds by country") + } + + return validatedHotelIds.data + }, + env.CACHE_TIME_HOTELS + ) + + metricsGetHotelIdsByCountry.success() + + return result +} + +export async function getHotelsByHotelIds({ + hotelIds, + lang, + serviceToken, +}: { + hotelIds: string[] + lang: Lang + serviceToken: string +}) { + const cacheClient = await getCacheClient() + const cacheKey = `${lang}:getHotelsByHotelIds:hotels:${hotelIds.sort().join(",")}` + + return await cacheClient.cacheOrGet( + cacheKey, + async () => { + const hotelPages = await getHotelPageUrls(lang) + const chunkedHotelIds = chunk(hotelIds, 10) + + const hotels: DestinationPagesHotelData[] = [] + for (const hotelIdChunk of chunkedHotelIds) { + const chunkedHotels = await Promise.all( + hotelIdChunk.map(async (hotelId) => { + const hotelResponse = await getHotel( + { hotelId, language: lang, isCardOnlyPayment: false }, + serviceToken + ) + + if (!hotelResponse) { + throw new Error(`Hotel not found: ${hotelId}`) + } + + const hotelPage = hotelPages.find( + (page) => page.hotelId === hotelId + ) + const { hotel, cities } = hotelResponse + const data: DestinationPagesHotelData = { + hotel: { + id: hotel.id, + galleryImages: hotel.galleryImages, + name: hotel.name, + tripadvisor: hotel.ratings?.tripAdvisor?.rating, + detailedFacilities: hotel.detailedFacilities || [], + location: hotel.location, + hotelType: hotel.hotelType, + type: hotel.type, + address: hotel.address, + cityIdentifier: cities?.[0]?.cityIdentifier, + hotelDescription: hotel.hotelContent?.texts.descriptions?.short, + }, + url: hotelPage?.url ?? "", + } + + return data + }) + ) + + hotels.push(...chunkedHotels) + } + return hotels.filter( + (hotel): hotel is DestinationPagesHotelData => !!hotel + ) + }, + "1d" + ) +} + +export async function getLocations({ + lang, + citiesByCountry, + serviceToken, +}: { + lang: Lang + citiesByCountry: CitiesGroupedByCountry | null + serviceToken: string +}) { + const cacheClient = await getCacheClient() + const countryKeys = Object.keys(citiesByCountry ?? {}) + let cacheKey = `${lang}:locations` + + if (countryKeys.length) { + cacheKey += `:${countryKeys.join(",")}` + } + + return await cacheClient.cacheOrGet( + cacheKey.toLowerCase(), + async () => { + const params = new URLSearchParams({ + language: toApiLang(lang), + }) + + const apiResponse = await api.get( + api.endpoints.v1.Hotel.locations, + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + params + ) + if (!apiResponse.ok) { + if (apiResponse.status === 401) { + throw new Error("unauthorized") + } else if (apiResponse.status === 403) { + throw new Error("forbidden") + } + throw new Error("downstream error") + } + + const apiJson = await apiResponse.json() + const verifiedLocations = locationsSchema.safeParse(apiJson) + if (!verifiedLocations.success) { + console.info(`Locations Verification Failed`) + console.error(verifiedLocations.error) + throw new Error("Unable to parse locations") + } + const chunkedLocations = chunk(verifiedLocations.data.data, 10) + + let locations: z.infer["data"] = [] + + for (const chunk of chunkedLocations) { + const chunkLocations = await Promise.all( + chunk.map(async (location) => { + if (location.type === "cities") { + if (citiesByCountry) { + const country = Object.keys(citiesByCountry).find((country) => + citiesByCountry[country].find( + (loc) => loc.name === location.name + ) + ) + if (country) { + return { + ...location, + country, + } + } else { + console.info( + `Location cannot be found in any of the countries cities` + ) + console.info(location) + } + } + } else if (location.type === "hotels") { + if (location.relationships.city?.url) { + const city = await getCity({ + cityUrl: location.relationships.city.url, + serviceToken, + }) + if (city) { + return deepmerge(location, { + relationships: { + city, + }, + }) + } + } + } + + return location + }) + ) + + locations.push(...chunkLocations) + } + + return locations + }, + "1d" + ) +} + +export const getHotel = cache( + async (input: HotelInput, serviceToken: string) => { + const { hotelId, language, isCardOnlyPayment } = input + + const getHotelCounter = createCounter("hotel", "getHotel") + const metricsGetHotel = getHotelCounter.init({ + hotelId, + language, + isCardOnlyPayment, + }) + + metricsGetHotel.start() + + const cacheClient = await getCacheClient() + + const result = await cacheClient.cacheOrGet( + `${input.language}:hotel:${input.hotelId}:${!!input.isCardOnlyPayment}`, + async () => { + /** + * Since API expects the params appended and not just + * a comma separated string we need to initialize the + * SearchParams with a sequence of pairs + * (include=City&include=NearbyHotels&include=Restaurants etc.) + **/ + const params = new URLSearchParams([ + ["include", "AdditionalData"], + ["include", "City"], + ["include", "NearbyHotels"], + ["include", "Restaurants"], + ["include", "RoomCategories"], + ["language", toApiLang(language)], + ]) + + const apiResponse = await api.get( + api.endpoints.v1.Hotel.Hotels.hotel(hotelId), + { + headers: { + Authorization: `Bearer ${serviceToken}`, + }, + }, + params + ) + + if (!apiResponse.ok) { + await metricsGetHotel.httpError(apiResponse) + return null + } + + const apiJson = await apiResponse.json() + const validateHotelData = hotelSchema.safeParse(apiJson) + + if (!validateHotelData.success) { + metricsGetHotel.validationError(validateHotelData.error) + throw badRequestError() + } + + const hotelData = validateHotelData.data + + if (isCardOnlyPayment) { + hotelData.hotel.merchantInformationData.alternatePaymentOptions = [] + } + + const gallery = hotelData.additionalData?.gallery + if (gallery) { + const smallerImages = gallery.smallerImages + const hotelGalleryImages = + hotelData.hotel.hotelType === HotelTypeEnum.Signature + ? smallerImages.slice(0, 10) + : smallerImages.slice(0, 6) + hotelData.hotel.galleryImages = hotelGalleryImages + } + + return hotelData + }, + env.CACHE_TIME_HOTELS + ) + + metricsGetHotel.success() + + return result + } +) + +export async function getCity({ + cityUrl, + serviceToken, +}: { + cityUrl: string + serviceToken: string +}): Promise { + const cacheClient = await getCacheClient() + return await cacheClient.cacheOrGet( + cityUrl, + async () => { + const url = new URL(cityUrl) + const cityResponse = await api.get( + url.pathname as Endpoint, + { headers: { Authorization: `Bearer ${serviceToken}` } }, + url.searchParams + ) + + if (!cityResponse.ok) { + return null + } + + const cityJson = await cityResponse.json() + const city = citiesSchema.safeParse(cityJson) + if (!city.success) { + console.info(`Validation of city failed`) + console.info(`cityUrl: ${cityUrl}`) + console.error(city.error) + return null + } + + return city.data + }, + "1d" + ) +} diff --git a/packages/trpc/lib/routers/types.ts b/packages/trpc/lib/routers/types.ts new file mode 100644 index 000000000..70b26df4f --- /dev/null +++ b/packages/trpc/lib/routers/types.ts @@ -0,0 +1,27 @@ +import type { Lang } from "@scandic-hotels/common/constants/language" + +export type TrackingPageData = { + pageId: string + createDate?: string + publishDate?: string + domainLanguage: Lang + pageType: string + channel: TrackingSDKChannel + siteVersion: "new-web" + pageName: string + domain?: string + siteSections: string + pageLoadTime?: number // Page load time in seconds + lcpTime?: number // Largest contentful paint time in seconds + sessionId?: string | null +} + +type TrackingSDKChannel = + | "scandic-friends" + | "static-content-page" + | "hotelreservation" + | "collection-page" + | "campaign-page" + | "hotels" + | "homepage" + | "campaign-overview-page" diff --git a/apps/scandic-web/services/cms/getUidAndContentTypeByPath.ts b/packages/trpc/lib/services/cms/getUidAndContentTypeByPath.ts similarity index 56% rename from apps/scandic-web/services/cms/getUidAndContentTypeByPath.ts rename to packages/trpc/lib/services/cms/getUidAndContentTypeByPath.ts index 7b2539283..006dc8469 100644 --- a/apps/scandic-web/services/cms/getUidAndContentTypeByPath.ts +++ b/packages/trpc/lib/services/cms/getUidAndContentTypeByPath.ts @@ -1,8 +1,8 @@ import { Lang } from "@scandic-hotels/common/constants/language" +import { findLang } from "@scandic-hotels/common/utils/languages" +import { removeTrailingSlash } from "@scandic-hotels/common/utils/url" -import { resolve as resolveEntry } from "@/utils/entry" -import { findLang } from "@/utils/languages" -import { removeTrailingSlash } from "@/utils/url" +import { resolve as resolveEntry } from "../../utils/entry" export const getUidAndContentTypeByPath = async (pathname: string) => { const lang = findLang(pathname) @@ -11,10 +11,10 @@ export const getUidAndContentTypeByPath = async (pathname: string) => { const contentTypePathName = pathWithoutTrailingSlash.replace(`/${lang}`, "") - const { contentType, uid } = await resolveEntry( + const { contentType, uid, error } = await resolveEntry( contentTypePathName, lang ?? Lang.en ) - return { contentType, uid } + return { contentType, uid, error } } diff --git a/apps/scandic-web/types/rte/enums.ts b/packages/trpc/lib/types/RTEenums.ts similarity index 100% rename from apps/scandic-web/types/rte/enums.ts rename to packages/trpc/lib/types/RTEenums.ts diff --git a/apps/scandic-web/types/trpc/routers/contentstack/accountPage.ts b/packages/trpc/lib/types/accountPage.ts similarity index 89% rename from apps/scandic-web/types/trpc/routers/contentstack/accountPage.ts rename to packages/trpc/lib/types/accountPage.ts index 81b3ed3f4..b6461ab57 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/accountPage.ts +++ b/packages/trpc/lib/types/accountPage.ts @@ -4,7 +4,7 @@ import type { accountPageRefsSchema, accountPageSchema, blocksSchema, -} from "@/server/routers/contentstack/accountPage/output" +} from "../routers/contentstack/accountPage/output" export interface GetAccountPageRefsSchema extends z.input {} diff --git a/apps/scandic-web/types/enums/accountPage.ts b/packages/trpc/lib/types/accountPageEnum.ts similarity index 100% rename from apps/scandic-web/types/enums/accountPage.ts rename to packages/trpc/lib/types/accountPageEnum.ts diff --git a/packages/trpc/lib/types/alertType.ts b/packages/trpc/lib/types/alertType.ts new file mode 100644 index 000000000..a8cfdc2f8 --- /dev/null +++ b/packages/trpc/lib/types/alertType.ts @@ -0,0 +1,6 @@ +export enum AlertTypeEnum { + Info = "info", + Warning = "warning", + Alarm = "alarm", + Success = "success", +} diff --git a/apps/scandic-web/types/enums/blocks.ts b/packages/trpc/lib/types/blocks.ts similarity index 100% rename from apps/scandic-web/types/enums/blocks.ts rename to packages/trpc/lib/types/blocks.ts diff --git a/apps/scandic-web/types/trpc/routers/contentstack/breadcrumbs.ts b/packages/trpc/lib/types/breadcrumbs.ts similarity index 86% rename from apps/scandic-web/types/trpc/routers/contentstack/breadcrumbs.ts rename to packages/trpc/lib/types/breadcrumbs.ts index e9ebfa773..31f5b949c 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/breadcrumbs.ts +++ b/packages/trpc/lib/types/breadcrumbs.ts @@ -4,7 +4,7 @@ import type { breadcrumbsRefsSchema, breadcrumbsSchema, rawBreadcrumbsDataSchema, -} from "@/server/routers/contentstack/breadcrumbs/output" +} from "../routers/contentstack/breadcrumbs/output" export interface BreadcrumbsRefsSchema extends z.input {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/campaignOverviewPage.ts b/packages/trpc/lib/types/campaignOverviewPage.ts similarity index 90% rename from apps/scandic-web/types/trpc/routers/contentstack/campaignOverviewPage.ts rename to packages/trpc/lib/types/campaignOverviewPage.ts index bc7f43a66..b245c97e6 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/campaignOverviewPage.ts +++ b/packages/trpc/lib/types/campaignOverviewPage.ts @@ -3,7 +3,7 @@ import type { z } from "zod" import type { campaignOverviewPageRefsSchema, campaignOverviewPageSchema, -} from "@/server/routers/contentstack/campaignOverviewPage/output" +} from "../routers/contentstack/campaignOverviewPage/output" export interface GetCampaignOverviewPageData extends z.input {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/campaignPage.ts b/packages/trpc/lib/types/campaignPage.ts similarity index 59% rename from apps/scandic-web/types/trpc/routers/contentstack/campaignPage.ts rename to packages/trpc/lib/types/campaignPage.ts index af861ca40..102dd2fde 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/campaignPage.ts +++ b/packages/trpc/lib/types/campaignPage.ts @@ -4,8 +4,19 @@ import type { campaignPageRefsSchema, campaignPageSchema, heroSchema, -} from "@/server/routers/contentstack/campaignPage/output" -import type { essentialsSchema } from "@/server/routers/contentstack/schemas/blocks/essentials" +} from "../routers/contentstack/campaignPage/output" +import type { essentialsSchema } from "../routers/contentstack/schemas/blocks/essentials" + +export namespace CampaignPageEnum { + export namespace ContentStack { + export const enum blocks { + Essentials = "CampaignPageBlocksEssentials", + CarouselCards = "CampaignPageBlocksCarouselCards", + Accordion = "CampaignPageBlocksAccordion", + HotelListing = "CampaignPageBlocksHotelListing", + } + } +} export interface GetCampaignPageData extends z.input {} diff --git a/apps/scandic-web/types/enums/cards.ts b/packages/trpc/lib/types/cardsEnum.ts similarity index 100% rename from apps/scandic-web/types/enums/cards.ts rename to packages/trpc/lib/types/cardsEnum.ts diff --git a/apps/scandic-web/types/enums/cardsGrid.ts b/packages/trpc/lib/types/cardsGridEnum.ts similarity index 94% rename from apps/scandic-web/types/enums/cardsGrid.ts rename to packages/trpc/lib/types/cardsGridEnum.ts index 2675d3488..bf8f527f5 100644 --- a/apps/scandic-web/types/enums/cardsGrid.ts +++ b/packages/trpc/lib/types/cardsGridEnum.ts @@ -1,4 +1,4 @@ -import { CardsEnum } from "./cards" +import { CardsEnum } from "./cardsEnum" /** * Enums specific to the CardsGrid presentation context. diff --git a/apps/scandic-web/types/trpc/routers/contentstack/collectionPage.ts b/packages/trpc/lib/types/collectionPage.ts similarity index 58% rename from apps/scandic-web/types/trpc/routers/contentstack/collectionPage.ts rename to packages/trpc/lib/types/collectionPage.ts index 3cffd6e05..dd9014843 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/collectionPage.ts +++ b/packages/trpc/lib/types/collectionPage.ts @@ -4,7 +4,7 @@ import type { blocksSchema, collectionPageRefsSchema, collectionPageSchema, -} from "@/server/routers/contentstack/collectionPage/output" +} from "../routers/contentstack/collectionPage/output" export interface GetCollectionPageRefsSchema extends z.input {} @@ -18,3 +18,14 @@ export interface GetCollectionPageSchema export interface CollectionPage extends z.output {} export type Block = z.output + +export namespace CollectionPageEnum { + export namespace ContentStack { + export const enum blocks { + CardsGrid = "CollectionPageBlocksCardsGrid", + DynamicContent = "CollectionPageBlocksDynamicContent", + Shortcuts = "CollectionPageBlocksShortcuts", + UspGrid = "CollectionPageBlocksUspGrid", + } + } +} diff --git a/apps/scandic-web/types/enums/content.ts b/packages/trpc/lib/types/content.ts similarity index 100% rename from apps/scandic-web/types/enums/content.ts rename to packages/trpc/lib/types/content.ts diff --git a/apps/scandic-web/types/enums/contentPage.ts b/packages/trpc/lib/types/contentPage.ts similarity index 57% rename from apps/scandic-web/types/enums/contentPage.ts rename to packages/trpc/lib/types/contentPage.ts index 55fb12c35..8d3b1a717 100644 --- a/apps/scandic-web/types/enums/contentPage.ts +++ b/packages/trpc/lib/types/contentPage.ts @@ -1,3 +1,29 @@ +import type { z } from "zod" + +import type { + blocksSchema, + contentPageRefsSchema, + contentPageSchema, + sidebarSchema, +} from "../routers/contentstack/contentPage/output" + +export interface GetContentPageRefsSchema + extends z.input {} + +export interface ContentPageRefs + extends z.output {} + +export interface GetContentPageSchema + extends z.input {} + +export interface ContentPage extends z.output {} + +export type Block = z.output + +export type GetBlock = z.input + +export type SidebarBlock = z.output + export namespace ContentPageEnum { export namespace ContentStack { export const enum blocks { diff --git a/apps/scandic-web/types/enums/country.ts b/packages/trpc/lib/types/country.ts similarity index 100% rename from apps/scandic-web/types/enums/country.ts rename to packages/trpc/lib/types/country.ts diff --git a/apps/scandic-web/types/trpc/routers/contentstack/destinationCityPage.ts b/packages/trpc/lib/types/destinationCityPage.ts similarity index 81% rename from apps/scandic-web/types/trpc/routers/contentstack/destinationCityPage.ts rename to packages/trpc/lib/types/destinationCityPage.ts index b5b7fda4e..7badad439 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/destinationCityPage.ts +++ b/packages/trpc/lib/types/destinationCityPage.ts @@ -7,7 +7,16 @@ import type { destinationCityListDataSchema, destinationCityPageRefsSchema, destinationCityPageSchema, -} from "@/server/routers/contentstack/destinationCityPage/output" +} from "../routers/contentstack/destinationCityPage/output" + +export namespace DestinationCityPageEnum { + export namespace ContentStack { + export const enum blocks { + Accordion = "DestinationCityPageBlocksAccordion", + Content = "DestinationCityPageBlocksContent", + } + } +} export interface GetDestinationCityPageData extends z.input {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/destinationCountryPage.ts b/packages/trpc/lib/types/destinationCountryPage.ts similarity index 72% rename from apps/scandic-web/types/trpc/routers/contentstack/destinationCountryPage.ts rename to packages/trpc/lib/types/destinationCountryPage.ts index 58e962451..75e812854 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/destinationCountryPage.ts +++ b/packages/trpc/lib/types/destinationCountryPage.ts @@ -5,7 +5,16 @@ import type { countryPageUrlsSchema, destinationCountryPageRefsSchema, destinationCountryPageSchema, -} from "@/server/routers/contentstack/destinationCountryPage/output" +} from "../routers/contentstack/destinationCountryPage/output" + +export namespace DestinationCountryPageEnum { + export namespace ContentStack { + export const enum blocks { + Accordion = "DestinationCountryPageBlocksAccordion", + Content = "DestinationCountryPageBlocksContent", + } + } +} export interface GetDestinationCountryPageData extends z.input {} diff --git a/packages/trpc/lib/types/destinationFilterAndSort.ts b/packages/trpc/lib/types/destinationFilterAndSort.ts new file mode 100644 index 000000000..86ebf7ddd --- /dev/null +++ b/packages/trpc/lib/types/destinationFilterAndSort.ts @@ -0,0 +1,11 @@ +export interface Filter { + name: string + slug: string + filterType: string + sortOrder: number +} + +export interface CategorizedFilters { + facilityFilters: Filter[] + surroundingsFilters: Filter[] +} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/destinationOverviewPage.ts b/packages/trpc/lib/types/destinationOverviewPage.ts similarity index 70% rename from apps/scandic-web/types/trpc/routers/contentstack/destinationOverviewPage.ts rename to packages/trpc/lib/types/destinationOverviewPage.ts index 3c94c3cb7..d26382366 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/destinationOverviewPage.ts +++ b/packages/trpc/lib/types/destinationOverviewPage.ts @@ -4,7 +4,15 @@ import type { blocksSchema, destinationOverviewPageRefsSchema, destinationOverviewPageSchema, -} from "@/server/routers/contentstack/destinationOverviewPage/output" +} from "../routers/contentstack/destinationOverviewPage/output" + +export namespace DestinationOverviewPageEnum { + export namespace ContentStack { + export const enum blocks { + CardGallery = "DestinationOverviewPageBlocksCardGallery", + } + } +} export interface GetDestinationOverviewPageData extends z.input {} diff --git a/apps/scandic-web/types/components/destinationOverviewPage/destinationsList/destinationsData.ts b/packages/trpc/lib/types/destinationsData.ts similarity index 55% rename from apps/scandic-web/types/components/destinationOverviewPage/destinationsList/destinationsData.ts rename to packages/trpc/lib/types/destinationsData.ts index 09c99842d..a28043f80 100644 --- a/apps/scandic-web/types/components/destinationOverviewPage/destinationsList/destinationsData.ts +++ b/packages/trpc/lib/types/destinationsData.ts @@ -14,14 +14,3 @@ export type DestinationCountry = { } export type DestinationsData = DestinationCountry[] - -export type DestinationsListProps = { - destinations: DestinationsData -} - -export type DestinationProps = { - country: string - countryUrl: string | undefined - numberOfHotels: number - cities: DestinationCountry["cities"] -} diff --git a/apps/scandic-web/types/enums/dynamicContent.ts b/packages/trpc/lib/types/dynamicContent.ts similarity index 100% rename from apps/scandic-web/types/enums/dynamicContent.ts rename to packages/trpc/lib/types/dynamicContent.ts diff --git a/apps/scandic-web/types/requests/utils/edges.ts b/packages/trpc/lib/types/edges.ts similarity index 100% rename from apps/scandic-web/types/requests/utils/edges.ts rename to packages/trpc/lib/types/edges.ts diff --git a/packages/trpc/lib/types/embeds.ts b/packages/trpc/lib/types/embeds.ts new file mode 100644 index 000000000..7089fd9e4 --- /dev/null +++ b/packages/trpc/lib/types/embeds.ts @@ -0,0 +1,5 @@ +import type { z } from "zod" + +import type { contentEmbedsSchema } from "../routers/contentstack/schemas/blocks/contentEmbeds" + +export type Embeds = z.output diff --git a/apps/scandic-web/types/requests/entry.ts b/packages/trpc/lib/types/entry.ts similarity index 100% rename from apps/scandic-web/types/requests/entry.ts rename to packages/trpc/lib/types/entry.ts diff --git a/apps/scandic-web/types/components/footer/footer.ts b/packages/trpc/lib/types/footer.ts similarity index 86% rename from apps/scandic-web/types/components/footer/footer.ts rename to packages/trpc/lib/types/footer.ts index 8dd4f507a..93a85052c 100644 --- a/apps/scandic-web/types/components/footer/footer.ts +++ b/packages/trpc/lib/types/footer.ts @@ -4,7 +4,7 @@ import type { validateFooterConfigSchema, validateFooterRefConfigSchema, validateLinkItem, -} from "@/server/routers/contentstack/base/output" +} from "../routers/contentstack/base/output" export type FooterRefDataRaw = z.infer export type FooterDataRaw = z.infer diff --git a/apps/scandic-web/types/trpc/routers/contentstack/header.ts b/packages/trpc/lib/types/header.ts similarity index 88% rename from apps/scandic-web/types/trpc/routers/contentstack/header.ts rename to packages/trpc/lib/types/header.ts index ec4bf4626..30a1e5c9d 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/header.ts +++ b/packages/trpc/lib/types/header.ts @@ -4,7 +4,7 @@ import type { headerRefsSchema, headerSchema, menuItemSchema, -} from "@/server/routers/contentstack/base/output" +} from "../routers/contentstack/base/output" export type GetHeaderRefs = z.input export type HeaderRefs = NonNullable> diff --git a/apps/scandic-web/types/hotel.ts b/packages/trpc/lib/types/hotel.ts similarity index 57% rename from apps/scandic-web/types/hotel.ts rename to packages/trpc/lib/types/hotel.ts index 7ba265fc8..a0f1e163a 100644 --- a/apps/scandic-web/types/hotel.ts +++ b/packages/trpc/lib/types/hotel.ts @@ -1,37 +1,40 @@ import type { z } from "zod" -import type { MarkerInfo } from "@/types/components/maps/marker" +import type { + cityCoordinatesInputSchema, + hotelInputSchema, +} from "../routers/hotels/input" import type { destinationPagesHotelDataSchema, hotelSchema, -} from "@/server/routers/hotels/output" -import type { citySchema } from "@/server/routers/hotels/schemas/city" -import type { attributesSchema } from "@/server/routers/hotels/schemas/hotel" -import type { addressSchema } from "@/server/routers/hotels/schemas/hotel/address" -import type { hotelContentSchema } from "@/server/routers/hotels/schemas/hotel/content" +} from "../routers/hotels/output" +import type { citySchema } from "../routers/hotels/schemas/city" +import type { attributesSchema } from "../routers/hotels/schemas/hotel" +import type { addressSchema } from "../routers/hotels/schemas/hotel/address" +import type { hotelContentSchema } from "../routers/hotels/schemas/hotel/content" import type { detailedFacilitiesSchema, detailedFacilitySchema, -} from "@/server/routers/hotels/schemas/hotel/detailedFacility" -import type { checkinSchema } from "@/server/routers/hotels/schemas/hotel/facts" -import type { healthFacilitySchema } from "@/server/routers/hotels/schemas/hotel/healthFacilities" +} from "../routers/hotels/schemas/hotel/detailedFacility" +import type { checkinSchema } from "../routers/hotels/schemas/hotel/facts" +import type { healthFacilitySchema } from "../routers/hotels/schemas/hotel/healthFacilities" import type { extraPageSchema, transformAdditionalData, -} from "@/server/routers/hotels/schemas/hotel/include/additionalData" -import type { facilitySchema } from "@/server/routers/hotels/schemas/hotel/include/additionalData/facility" -import type { nearbyHotelsSchema } from "@/server/routers/hotels/schemas/hotel/include/nearbyHotels" +} from "../routers/hotels/schemas/hotel/include/additionalData" +import type { facilitySchema } from "../routers/hotels/schemas/hotel/include/additionalData/facility" +import type { nearbyHotelsSchema } from "../routers/hotels/schemas/hotel/include/nearbyHotels" import type { openingHoursDetailsSchema, openingHoursSchema, restaurantsSchema, -} from "@/server/routers/hotels/schemas/hotel/include/restaurants" -import type { transformRoomCategories } from "@/server/routers/hotels/schemas/hotel/include/roomCategories" -import type { locationSchema } from "@/server/routers/hotels/schemas/hotel/location" -import type { parkingSchema } from "@/server/routers/hotels/schemas/hotel/parking" -import type { pointOfInterestSchema } from "@/server/routers/hotels/schemas/hotel/poi" -import type { ratingsSchema } from "@/server/routers/hotels/schemas/hotel/rating" -import type { imageSchema } from "@/server/routers/hotels/schemas/image" +} from "../routers/hotels/schemas/hotel/include/restaurants" +import type { transformRoomCategories } from "../routers/hotels/schemas/hotel/include/roomCategories" +import type { locationSchema } from "../routers/hotels/schemas/hotel/location" +import type { parkingSchema } from "../routers/hotels/schemas/hotel/parking" +import type { pointOfInterestSchema } from "../routers/hotels/schemas/hotel/poi" +import type { ratingsSchema } from "../routers/hotels/schemas/hotel/rating" +import type { imageSchema } from "../routers/hotels/schemas/image" export type HotelData = z.output @@ -66,13 +69,6 @@ export type Room = ReturnType export type RoomCategory = Room export type RoomCategories = RoomCategory[] -export type PoiMapMarkersProps = { - activePoi?: string | null - coordinates: { lat: number; lng: number } - onActivePoiChange?: (poiName: string | null) => void - pointsOfInterest: PointOfInterest[] - markerInfo: MarkerInfo -} export type HotelTripAdvisor = | NonNullable["tripAdvisor"] | undefined @@ -86,3 +82,8 @@ export type HotelDataWithUrl = HotelData & { url: string } export type DestinationPagesHotelData = z.output< typeof destinationPagesHotelDataSchema > + +export type CityCoordinatesInput = z.input +export type HotelInput = z.input + +export type RoomType = Pick diff --git a/apps/scandic-web/types/trpc/routers/contentstack/hotelPage.ts b/packages/trpc/lib/types/hotelPage.ts similarity index 79% rename from apps/scandic-web/types/trpc/routers/contentstack/hotelPage.ts rename to packages/trpc/lib/types/hotelPage.ts index 641d0cf0f..f58fd8519 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/hotelPage.ts +++ b/packages/trpc/lib/types/hotelPage.ts @@ -6,9 +6,9 @@ import type { hotelPageRefsSchema, hotelPageSchema, hotelPageUrlsSchema, -} from "@/server/routers/contentstack/hotelPage/output" -import type { activitiesCardSchema } from "@/server/routers/contentstack/schemas/blocks/activitiesCard" -import type { spaPageSchema } from "@/server/routers/contentstack/schemas/blocks/spaPage" +} from "../routers/contentstack/hotelPage/output" +import type { activitiesCardSchema } from "../routers/contentstack/schemas/blocks/activitiesCard" +import type { spaPageSchema } from "../routers/contentstack/schemas/blocks/spaPage" export interface GetHotelPageData extends z.input {} export interface HotelPage extends z.output {} diff --git a/packages/trpc/lib/types/hotelPageEnum.ts b/packages/trpc/lib/types/hotelPageEnum.ts new file mode 100644 index 000000000..8cc5f8839 --- /dev/null +++ b/packages/trpc/lib/types/hotelPageEnum.ts @@ -0,0 +1,9 @@ +export namespace HotelPageEnum { + export namespace ContentStack { + export const enum blocks { + Faq = "HotelPageFaq", + ActivitiesCard = "HotelPageContentUpcomingActivitiesCard", + SpaPage = "HotelPageContentSpaPage", + } + } +} diff --git a/apps/scandic-web/types/image.ts b/packages/trpc/lib/types/image.ts similarity index 77% rename from apps/scandic-web/types/image.ts rename to packages/trpc/lib/types/image.ts index f5efeae00..797694767 100644 --- a/apps/scandic-web/types/image.ts +++ b/packages/trpc/lib/types/image.ts @@ -1,3 +1,8 @@ +export interface FocalPoint { + x: number + y: number +} + export interface Image { description?: string | null dimension: { diff --git a/apps/scandic-web/types/components/imageVault.ts b/packages/trpc/lib/types/imageVault.ts similarity index 84% rename from apps/scandic-web/types/components/imageVault.ts rename to packages/trpc/lib/types/imageVault.ts index dae2577e2..2fead48ec 100644 --- a/apps/scandic-web/types/components/imageVault.ts +++ b/packages/trpc/lib/types/imageVault.ts @@ -7,10 +7,9 @@ * They have been clean up and amended to. */ -import { z } from "zod" - -import { imageVaultAssetSchema } from "@/server/routers/contentstack/schemas/imageVault" +import type { z } from "zod" +import type { imageVaultAssetSchema } from "../routers/contentstack/schemas/imageVault" import type { FocalPoint } from "./image" export type ImageVaultAssetResponse = z.infer diff --git a/apps/scandic-web/types/enums/joinLoyaltyContact.ts b/packages/trpc/lib/types/joinLoyaltyContact.ts similarity index 100% rename from apps/scandic-web/types/enums/joinLoyaltyContact.ts rename to packages/trpc/lib/types/joinLoyaltyContact.ts diff --git a/apps/scandic-web/types/requests/languageSwitcher.ts b/packages/trpc/lib/types/languageSwitcher.ts similarity index 100% rename from apps/scandic-web/types/requests/languageSwitcher.ts rename to packages/trpc/lib/types/languageSwitcher.ts diff --git a/apps/scandic-web/types/trpc/routers/hotel/locations.ts b/packages/trpc/lib/types/locations.ts similarity index 94% rename from apps/scandic-web/types/trpc/routers/hotel/locations.ts rename to packages/trpc/lib/types/locations.ts index c8bb2c151..1fac5fe37 100644 --- a/apps/scandic-web/types/trpc/routers/hotel/locations.ts +++ b/packages/trpc/lib/types/locations.ts @@ -4,7 +4,7 @@ import type { citiesByCountrySchema, countriesSchema, locationsSchema, -} from "@/server/routers/hotels/output" +} from "../routers/hotels/output" export interface LocationSchema extends z.output {} diff --git a/apps/scandic-web/types/trpc/routers/contentstack/loyaltyPage.ts b/packages/trpc/lib/types/loyaltyPage.ts similarity index 90% rename from apps/scandic-web/types/trpc/routers/contentstack/loyaltyPage.ts rename to packages/trpc/lib/types/loyaltyPage.ts index 9c0ecd203..1b196e559 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/loyaltyPage.ts +++ b/packages/trpc/lib/types/loyaltyPage.ts @@ -5,7 +5,7 @@ import type { loyaltyPageRefsSchema, loyaltyPageSchema, sidebarSchema, -} from "@/server/routers/contentstack/loyaltyPage/output" +} from "../routers/contentstack/loyaltyPage/output" export interface GetLoyaltyPageRefsSchema extends z.input {} diff --git a/apps/scandic-web/types/components/maps/marker.ts b/packages/trpc/lib/types/marker.ts similarity index 100% rename from apps/scandic-web/types/components/maps/marker.ts rename to packages/trpc/lib/types/marker.ts diff --git a/packages/trpc/lib/types/refs.ts b/packages/trpc/lib/types/refs.ts new file mode 100644 index 000000000..2674e8665 --- /dev/null +++ b/packages/trpc/lib/types/refs.ts @@ -0,0 +1,3 @@ +import type { System } from "../routers/contentstack/schemas/system" + +export interface NodeRefs extends System {} diff --git a/apps/scandic-web/types/request.ts b/packages/trpc/lib/types/requestData.ts similarity index 100% rename from apps/scandic-web/types/request.ts rename to packages/trpc/lib/types/requestData.ts diff --git a/apps/scandic-web/types/trpc/routers/contentstack/reward.ts b/packages/trpc/lib/types/reward.ts similarity index 95% rename from apps/scandic-web/types/trpc/routers/contentstack/reward.ts rename to packages/trpc/lib/types/reward.ts index fdf4a272f..208c00d49 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/reward.ts +++ b/packages/trpc/lib/types/reward.ts @@ -8,7 +8,7 @@ import type { REWARD_TYPES, rewardRefsSchema, validateCmsRewardsSchema, -} from "@/server/routers/contentstack/reward/output" +} from "../routers/contentstack/reward/output" export type { ApiReward, diff --git a/packages/trpc/lib/types/rewards.ts b/packages/trpc/lib/types/rewards.ts new file mode 100644 index 000000000..331a90748 --- /dev/null +++ b/packages/trpc/lib/types/rewards.ts @@ -0,0 +1,71 @@ +import type { + ApiReward, + BenefitReward, + CMSReward, + CouponReward, +} from "./reward" + +export type { BaseReward, Campaign, Reward, Surprise, Tier } + +export type RewardId = (typeof REWARD_IDS)[keyof typeof REWARD_IDS] + +export type RestaurantRewardId = (typeof RESTAURANT_REWARD_IDS)[number] + +type BaseReward = ApiReward & CMSReward +type Campaign = CouponReward & + CMSReward & { + rewardType: "Campaign" + } +type Surprise = CouponReward & + CMSReward & { + rewardType: "Surprise" + } +type Tier = BenefitReward & + CMSReward & { + rewardType: "Tier" + } +type MemberVoucher = CouponReward & + CMSReward & { + rewardType: "Member-voucher" + } +type Reward = Campaign | Surprise | Tier | MemberVoucher + +export const REWARD_IDS = { + // Food & Beverage + TenPercentFood: "tier_10_percent_food_tier", + TwoForOneBreakfast: "tier_2_for_one_breakfast", + FifteenPercentFood: "tier_15_percent_food", + FreeKidsDrink: "tier_free_kids_drink", + FreeBreakfast: "tier_free_breakfast", + + // Monetary Vouchers + Bonus50SEK: "tier_50_SEK_bonus_voucher", + Bonus75SEK: "tier_75_SEK_bonus_voucher", + Bonus100SEK: "tier_100_SEK_bonus_voucher", + Bonus150SEK: "tier_150_SEK_bonus_voucher", + Bonus200SEK: "tier_200_SEK_bonus_voucher", + + // Hotel Perks + EarlyCheckin: "tier_early_checkin_tier", + LateCheckout: "tier_late_checkout", + FreeUpgrade: "tier_free_upgrade", + RoomGuarantee48H: "tier_48_h_room_guarantee", + // GymAccess: "tier_gym_access", + + // Earning & Points + EarnRate25Percent: "tier_25_percent_earn_rate", + EarnRate50Percent: "tier_50_percent_earn_rate", + StayBoostForKids: "tier_stay_boost_for_kids", + MemberRate: "tier_member_rate", + + // Special + YearlyExclusiveGift: "tier_yearly_exclusive_gift", +} as const + +export const RESTAURANT_REWARD_IDS = [ + REWARD_IDS.TenPercentFood, + REWARD_IDS.TwoForOneBreakfast, + REWARD_IDS.FifteenPercentFood, + REWARD_IDS.FreeKidsDrink, + REWARD_IDS.FreeBreakfast, +] as const diff --git a/apps/scandic-web/types/trpc/routers/hotel/roomAvailability.ts b/packages/trpc/lib/types/roomAvailability.ts similarity index 72% rename from apps/scandic-web/types/trpc/routers/hotel/roomAvailability.ts rename to packages/trpc/lib/types/roomAvailability.ts index 0c0a9c0ce..dcdc4e71a 100644 --- a/apps/scandic-web/types/trpc/routers/hotel/roomAvailability.ts +++ b/packages/trpc/lib/types/roomAvailability.ts @@ -1,7 +1,7 @@ import type { z } from "zod" -import type { roomsAvailabilitySchema } from "@/server/routers/hotels/output" -import type { roomConfigurationSchema } from "@/server/routers/hotels/schemas/roomAvailability/configuration" +import type { roomsAvailabilitySchema } from "../routers/hotels/output" +import type { roomConfigurationSchema } from "../routers/hotels/schemas/roomAvailability/configuration" import type { corporateChequeProduct, priceProduct, @@ -9,8 +9,8 @@ import type { redemptionProduct, redemptionsProduct, voucherProduct, -} from "@/server/routers/hotels/schemas/roomAvailability/product" -import type { rateDefinitionSchema } from "@/server/routers/hotels/schemas/roomAvailability/rateDefinition" +} from "../routers/hotels/schemas/roomAvailability/product" +import type { rateDefinitionSchema } from "../routers/hotels/schemas/roomAvailability/rateDefinition" export type CorporateChequeProduct = z.output export type PriceProduct = z.output diff --git a/apps/scandic-web/types/enums/sidebar.ts b/packages/trpc/lib/types/sidebar.ts similarity index 100% rename from apps/scandic-web/types/enums/sidebar.ts rename to packages/trpc/lib/types/sidebar.ts diff --git a/apps/scandic-web/types/trpc/routers/contentstack/siteConfig.ts b/packages/trpc/lib/types/siteConfig.ts similarity index 92% rename from apps/scandic-web/types/trpc/routers/contentstack/siteConfig.ts rename to packages/trpc/lib/types/siteConfig.ts index 2d7acc074..f83a6d1a7 100644 --- a/apps/scandic-web/types/trpc/routers/contentstack/siteConfig.ts +++ b/packages/trpc/lib/types/siteConfig.ts @@ -4,7 +4,7 @@ import type { alertSchema, siteConfigRefSchema, siteConfigSchema, -} from "@/server/routers/contentstack/base/output" +} from "../routers/contentstack/base/output" export type GetSiteConfigRefData = z.infer diff --git a/apps/scandic-web/types/enums/uspGrid.ts b/packages/trpc/lib/types/uspGrid.ts similarity index 60% rename from apps/scandic-web/types/enums/uspGrid.ts rename to packages/trpc/lib/types/uspGrid.ts index 09eb3353c..e03f2fbbe 100644 --- a/apps/scandic-web/types/enums/uspGrid.ts +++ b/packages/trpc/lib/types/uspGrid.ts @@ -1,7 +1,9 @@ import { z } from "zod" -import { IconName } from "@/components/Icons/iconName" - +// TODO When original IconName enum is moved to common we should use it +enum IconName { + Snowflake = "Snowflake", +} export namespace UspGridEnum { export const enum icons { Snowflake = IconName.Snowflake, diff --git a/packages/trpc/lib/utils.ts b/packages/trpc/lib/utils.ts index e042f059b..4382c11eb 100644 --- a/packages/trpc/lib/utils.ts +++ b/packages/trpc/lib/utils.ts @@ -1,3 +1,4 @@ +// Move to separate files in /utils import { z } from "zod" import { Lang } from "@scandic-hotels/common/constants/language" @@ -5,3 +6,27 @@ import { Lang } from "@scandic-hotels/common/constants/language" export const langInput = z.object({ lang: z.nativeEnum(Lang), }) + +export function isDefined(argument: T | undefined | null): argument is T { + return argument !== undefined && argument !== null +} + +/** + * Helper function to convert Lang enum to API lang enum. + */ +export const toApiLang = (lang: Lang): string => { + const result = toApiLangMap[lang] + if (!result) { + throw new Error("Invalid language") + } + return result +} + +const toApiLangMap: { [key in Lang]: string } = { + [Lang.en]: "En", + [Lang.sv]: "Sv", + [Lang.no]: "No", + [Lang.fi]: "Fi", + [Lang.da]: "Da", + [Lang.de]: "De", +} diff --git a/apps/scandic-web/utils/contactConfig.ts b/packages/trpc/lib/utils/contactConfig.ts similarity index 88% rename from apps/scandic-web/utils/contactConfig.ts rename to packages/trpc/lib/utils/contactConfig.ts index 82930a03a..05bbd9d86 100644 --- a/apps/scandic-web/utils/contactConfig.ts +++ b/packages/trpc/lib/utils/contactConfig.ts @@ -1,7 +1,7 @@ import type { ContactConfig, ContactFieldGroups, -} from "@/server/routers/contentstack/base/output" +} from "../routers/contentstack/base/output" export function getValueFromContactConfig( keyString: string, diff --git a/apps/scandic-web/lib/discriminatedUnion.ts b/packages/trpc/lib/utils/discriminatedUnion.ts similarity index 87% rename from apps/scandic-web/lib/discriminatedUnion.ts rename to packages/trpc/lib/utils/discriminatedUnion.ts index 4da9486bb..861cd4c58 100644 --- a/apps/scandic-web/lib/discriminatedUnion.ts +++ b/packages/trpc/lib/utils/discriminatedUnion.ts @@ -1,9 +1,12 @@ import { z } from "zod" -import type { - DiscriminatedUnionError, - Option, -} from "@/types/discriminatedUnion" +import type { ZodDiscriminatedUnionOption, ZodError } from "zod" + +export interface DiscriminatedUnionError { + error: ZodError +} + +export interface Option extends ZodDiscriminatedUnionOption<"__typename"> {} /** * This file is created to handle our discriminated unions diff --git a/apps/scandic-web/utils/entry.ts b/packages/trpc/lib/utils/entry.ts similarity index 81% rename from apps/scandic-web/utils/entry.ts rename to packages/trpc/lib/utils/entry.ts index 6f4e351a8..9f2da65bd 100644 --- a/apps/scandic-web/utils/entry.ts +++ b/packages/trpc/lib/utils/entry.ts @@ -1,13 +1,11 @@ import { Lang } from "@scandic-hotels/common/constants/language" -import { batchRequest } from "@/lib/graphql/batchRequest" +import { batchRequest } from "../graphql/batchRequest" import { EntryByUrlBatch1, EntryByUrlBatch2, -} from "@/lib/graphql/Query/ResolveEntry.graphql" -import { internalServerError } from "@/server/errors/next" - -import { validateEntryResolveSchema } from "@/types/requests/entry" +} from "../graphql/Query/ResolveEntry.graphql" +import { validateEntryResolveSchema } from "../types/entry" export function resolveEntryCacheKey(lang: Lang, url: string) { return `${lang}:${url}:resolveentry` @@ -41,7 +39,9 @@ export async function resolve(url: string, lang = Lang.en) { const validatedData = validateEntryResolveSchema.safeParse(response.data) if (!validatedData.success) { - throw internalServerError(validatedData.error) + return { + error: validatedData.error, + } } for (const value of Object.values(validatedData.data)) { diff --git a/apps/scandic-web/utils/generateTag.ts b/packages/trpc/lib/utils/generateTag.ts similarity index 93% rename from apps/scandic-web/utils/generateTag.ts rename to packages/trpc/lib/utils/generateTag.ts index e1e3d4695..173c43c2c 100644 --- a/apps/scandic-web/utils/generateTag.ts +++ b/packages/trpc/lib/utils/generateTag.ts @@ -1,8 +1,8 @@ import type { Lang } from "@scandic-hotels/common/constants/language" -import type { System } from "@/types/requests/system" -import type { Edges } from "@/types/requests/utils/edges" -import type { NodeRefs } from "@/types/requests/utils/refs" +import type { System } from "../routers/contentstack/schemas/system" +import type { Edges } from "../types/edges" +import type { NodeRefs } from "../types/refs" /** * Function to generate tag for initial refs request diff --git a/packages/trpc/lib/utils/getSortedCities.ts b/packages/trpc/lib/utils/getSortedCities.ts new file mode 100644 index 000000000..d080bfcd0 --- /dev/null +++ b/packages/trpc/lib/utils/getSortedCities.ts @@ -0,0 +1,34 @@ +import { SortOption } from "../enums/destinationFilterAndSort" + +import type { DestinationCityListItem } from "../types/destinationCityPage" + +const CITY_SORTING_STRATEGIES: Partial< + Record< + SortOption, + (a: DestinationCityListItem, b: DestinationCityListItem) => number + > +> = { + [SortOption.Name]: function (a, b) { + return a.cityName.localeCompare(b.cityName) + }, + [SortOption.Recommended]: function (a, b) { + if (a.sort_order === null && b.sort_order === null) { + return a.cityName.localeCompare(b.cityName) + } + if (a.sort_order === null) { + return 1 + } + if (b.sort_order === null) { + return -1 + } + return b.sort_order - a.sort_order + }, +} + +export function getSortedCities( + cities: DestinationCityListItem[], + sortOption: SortOption +) { + const sortFn = CITY_SORTING_STRATEGIES[sortOption] + return sortFn ? cities.sort(sortFn) : cities +} diff --git a/apps/scandic-web/utils/imageVault.ts b/packages/trpc/lib/utils/imageVault.ts similarity index 79% rename from apps/scandic-web/utils/imageVault.ts rename to packages/trpc/lib/utils/imageVault.ts index e67e23864..dcdbd0c91 100644 --- a/apps/scandic-web/utils/imageVault.ts +++ b/packages/trpc/lib/utils/imageVault.ts @@ -1,7 +1,7 @@ import type { ImageVaultAsset, ImageVaultAssetResponse, -} from "@/types/components/imageVault" +} from "../types/imageVault" export function insertResponseToImageVaultAsset( response: ImageVaultAssetResponse @@ -36,9 +36,3 @@ export function insertResponseToImageVaultAsset( focalPoint: response.FocalPoint || { x: 50, y: 50 }, } } - -export function makeImageVaultImage(image: any) { - return image && !!Object.keys(image).length - ? insertResponseToImageVaultAsset(image as ImageVaultAssetResponse) - : undefined -} diff --git a/apps/scandic-web/utils/sort.ts b/packages/trpc/lib/utils/sortRoomConfigs.ts similarity index 66% rename from apps/scandic-web/utils/sort.ts rename to packages/trpc/lib/utils/sortRoomConfigs.ts index dd101b8c6..c06115a06 100644 --- a/apps/scandic-web/utils/sort.ts +++ b/packages/trpc/lib/utils/sortRoomConfigs.ts @@ -1,5 +1,6 @@ -import { AvailabilityEnum } from "@/types/components/hotelReservation/selectHotel/selectHotel" -import type { RoomConfiguration } from "@/types/trpc/routers/hotel/roomAvailability" +import { AvailabilityEnum } from "../enums/selectHotel" + +import type { RoomConfiguration } from "../types/roomAvailability" // Used to ensure `Available` rooms // are shown before all `NotAvailable` diff --git a/packages/trpc/package.json b/packages/trpc/package.json index 1f9e788c6..9d915bca6 100644 --- a/packages/trpc/package.json +++ b/packages/trpc/package.json @@ -5,21 +5,47 @@ "type": "module", "scripts": { "check-types": "tsc --noEmit", - "lint": "eslint . --max-warnings 0 && tsc --noEmit" + "lint": "eslint . --max-warnings 0 && tsc --noEmit", + "lint:fix": "eslint . --fix && tsc --noEmit" }, "exports": { ".": "./lib/index.ts", + "./types.d.ts": "./types.d.ts", "./context": "./lib/context.ts", "./errors": "./lib/errors.ts", "./procedures": "./lib/procedures.ts", - "./transformer": "./lib/transformer.ts" + "./transformer": "./lib/transformer.ts", + "./utils/generateTag": "./lib/utils/generateTag.ts", + "./graphql/request": "./lib/graphql/request.ts", + "./graphql/batchRequest": "./lib/graphql/batchRequest.ts", + "./routers/*": "./lib/routers/*/index.ts", + "./routers/contentstack/*": "./lib/routers/contentstack/*.ts", + "./routers/hotels/*": "./lib/routers/hotels/*.ts", + "./enums/*": "./lib/enums/*.ts", + "./types/*": "./lib/types/*.ts", + "./api": "./lib/api/index.ts", + "./utils": "./lib/utils.ts", + "./utils/*": "./lib/utils/*.ts", + "./cms/*": "./lib/services/cms/*.ts", + "./previewContext": "./lib/previewContext.ts", + "./graphql/Query/Current/CurrentBlockPage.graphql": "./lib/graphql/Query/Current/CurrentBlockPage.graphql", + "./graphql/Query/Current/CurrentBlockPageTrackingData.graphql": "./lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql" }, "dependencies": { "@scandic-hotels/common": "workspace:*", "@sentry/nextjs": "^8.41.0", "@t3-oss/env-nextjs": "^0.13.4", "@trpc/server": "^11.1.2", + "dayjs": "^1.11.13", + "deepmerge": "^4.3.1", + "fetch-retry": "^6.0.0", + "graphql": "^16.11.0", + "graphql-request": "^7.1.2", + "json-stable-stringify-without-jsonify": "^1.0.1", "next-auth": "5.0.0-beta.27", + "react": "19.1.0", + "server-only": "^0.0.1", + "slugify": "^1.6.6", "superjson": "^2.2.2", "zod": "^3.24.4" }, @@ -27,7 +53,9 @@ "@eslint/compat": "^1.2.9", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.26.0", + "@scandic-hotels/typescript-config": "workspace:*", "@types/lodash-es": "^4", + "@types/react": "19.1.0", "@typescript-eslint/eslint-plugin": "^8.32.0", "@typescript-eslint/parser": "^8.32.0", "eslint": "^9", diff --git a/packages/trpc/tsconfig.json b/packages/trpc/tsconfig.json index 1b8d2c58c..b79d97b7d 100644 --- a/packages/trpc/tsconfig.json +++ b/packages/trpc/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "@scandic-hotels/typescript-config/base.json", - "compilerOptions": { - "paths": { - "@/*": ["./*"] - } - }, - "include": ["**/*.ts"], + "include": ["**/*.ts", "**/*.d.ts"], "exclude": ["**/node_modules/**"] } diff --git a/apps/scandic-web/types/graphql.d.ts b/packages/trpc/types.d.ts similarity index 100% rename from apps/scandic-web/types/graphql.d.ts rename to packages/trpc/types.d.ts diff --git a/yarn.lock b/yarn.lock index f0cf7cf46..4ff606030 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7244,16 +7244,27 @@ __metadata: "@eslint/eslintrc": "npm:^3.3.1" "@eslint/js": "npm:^9.26.0" "@scandic-hotels/common": "workspace:*" + "@scandic-hotels/typescript-config": "workspace:*" "@sentry/nextjs": "npm:^8.41.0" "@t3-oss/env-nextjs": "npm:^0.13.4" "@trpc/server": "npm:^11.1.2" "@types/lodash-es": "npm:^4" + "@types/react": "npm:19.1.0" "@typescript-eslint/eslint-plugin": "npm:^8.32.0" "@typescript-eslint/parser": "npm:^8.32.0" + dayjs: "npm:^1.11.13" + deepmerge: "npm:^4.3.1" eslint: "npm:^9" eslint-plugin-import: "npm:^2.31.0" eslint-plugin-simple-import-sort: "npm:^12.1.1" + fetch-retry: "npm:^6.0.0" + graphql: "npm:^16.11.0" + graphql-request: "npm:^7.1.2" + json-stable-stringify-without-jsonify: "npm:^1.0.1" next-auth: "npm:5.0.0-beta.27" + react: "npm:19.1.0" + server-only: "npm:^0.0.1" + slugify: "npm:^1.6.6" superjson: "npm:^2.2.2" typescript: "npm:5.8.3" zod: "npm:^3.24.4"