diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 905167b2c..0ecdee375 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -52,10 +52,6 @@ GOOGLE_STATIC_MAP_SIGNATURE_SECRET="" GOOGLE_STATIC_MAP_ID="" GOOGLE_DYNAMIC_MAP_ID="" -NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE="false" - -ENABLE_BOOKING_WIDGET="false" -ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH="false" ENABLE_SURPRISES="true" ENABLE_DTMC="true" @@ -64,7 +60,6 @@ SHOW_SIGNUP_FLOW="true" USE_NEW_REWARD_MODEL="true" -SAS="1" SAS_POINT_TRANSFER_ENABLED="true" SAS_API_ENDPOINT="" SAS_AUTH_ENDPOINT="" diff --git a/apps/scandic-web/.env.test b/apps/scandic-web/.env.test index 9645745da..51fd48b42 100644 --- a/apps/scandic-web/.env.test +++ b/apps/scandic-web/.env.test @@ -41,14 +41,10 @@ GOOGLE_STATIC_MAP_KEY="test" GOOGLE_STATIC_MAP_SIGNATURE_SECRET="test" GOOGLE_STATIC_MAP_ID="test" GOOGLE_DYNAMIC_MAP_ID="test" -NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE="true" -NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE_LANG="en,sv,da,de,fi,no" SALESFORCE_PREFERENCE_BASE_URL="test" USE_NEW_REWARD_MODEL="true" TZ=UTC -ENABLE_BOOKING_WIDGET="false" -ENABLE_BOOKING_WIDGET_HOTELRESERVATION_PATH="false" ENABLE_SURPRISES="true" SHOW_SITE_WIDE_ALERT="false" diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/loading.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/loading.tsx index 55a761a80..c739b6635 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/loading.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/(contentTypes)/@preview/loading.tsx @@ -1,12 +1,5 @@ -import { env } from "@/env/server" - -import CurrentLoadingSpinner from "@/components/Current/LoadingSpinner" import LoadingSpinner from "@/components/LoadingSpinner" export default function Loading() { - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return - } - return } 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 4b9222854..3274dfacd 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 @@ -1,8 +1,5 @@ -import { notFound } from "next/navigation" import { Suspense } from "react" -import { env } from "@/env/server" - import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage" import DestinationCityPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCityPage/DestinationCityPageSkeleton" @@ -14,10 +11,6 @@ export default async function DestinationCityPagePage( props: PageArgs<{}, { view?: "map"; filterFromUrl?: string }> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return notFound() - } - return ( }> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return notFound() - } - return ( }> ) { - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return notFound() - } - return } 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 1080c4c16..38bc0365c 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 @@ -1,6 +1,5 @@ import { notFound } from "next/navigation" -import { env } from "@/env/server" import { getHotelPage } from "@/lib/trpc/memoizedRequests" import HotelMapPage from "@/components/ContentType/HotelMapPage" @@ -15,10 +14,6 @@ export default async function HotelPagePage( props: PageArgs<{}, { subpage?: string; view?: "map" }> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return notFound() - } - const hotelPageData = await getHotelPage() if (!hotelPageData) { 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 145e1eaa7..3b44d3394 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 @@ -1,7 +1,3 @@ -import { notFound } from "next/navigation" - -import { env } from "@/env/server" - import StartPage from "@/components/ContentType/StartPage" import { parseBookingWidgetSearchParams } from "@/utils/url" @@ -13,10 +9,6 @@ export default async function StartPagePage( props: PageArgs<{}, NextSearchParams> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return notFound() - } - const booking = parseBookingWidgetSearchParams(searchParams) return diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/layout.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/layout.tsx index 785aa448b..ac41219df 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/layout.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/layout.tsx @@ -1,13 +1,8 @@ -import { env } from "@/env/server" - -import type { LangParams, PageArgs } from "@/types/params" - -export async function generateMetadata(props: PageArgs) { - const params = await props.params; +export async function generateMetadata() { return { robots: { - index: env.isLangLive(params.lang), - follow: env.isLangLive(params.lang), + index: true, + follow: true, }, } } diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx index 8bb56b9e6..fdaf11d35 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/destination_city_page/[uid]/page.tsx @@ -1,4 +1,3 @@ -import { env } from "@/env/server" import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests" import { BookingWidget } from "@/components/BookingWidget" @@ -10,9 +9,6 @@ export default async function BookingWidgetDestinationCityPage( props: PageArgs<{}, NextSearchParams> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return null - } const { bookingCode } = searchParams const pageData = await getDestinationCityPage() diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx index e8ae3a0dc..b16b6644d 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/(contentTypes)/hotel_page/[uid]/page.tsx @@ -1,4 +1,3 @@ -import { env } from "@/env/server" import { getHotel, getHotelPage } from "@/lib/trpc/memoizedRequests" import { BookingWidget } from "@/components/BookingWidget" @@ -11,9 +10,6 @@ export default async function BookingWidgetHotelPage( props: PageArgs<{}, NextSearchParams & { subpage?: string }> ) { const searchParams = await props.searchParams - if (env.NEW_SITE_LIVE_STATUS === "NOT_LIVE") { - return null - } const hotelPageData = await getHotelPage() const hotelData = await getHotel({ diff --git a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx index bb8490c22..235081a69 100644 --- a/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/@bookingwidget/page.tsx @@ -1,5 +1,3 @@ -import { env } from "@/env/server" - import { BookingWidget } from "@/components/BookingWidget" import { parseBookingWidgetSearchParams } from "@/utils/url" @@ -8,11 +6,7 @@ import type { LangParams, NextSearchParams, PageArgs } from "@/types/params" export default async function BookingWidgetPage( props: PageArgs ) { - const params = await props.params const searchParams = await props.searchParams - if (!env.isLangLive(params.lang)) { - return null - } const booking = parseBookingWidgetSearchParams(searchParams) diff --git a/apps/scandic-web/app/[lang]/(partner)/layout.tsx b/apps/scandic-web/app/[lang]/(partner)/layout.tsx index 7c9ee2710..ce6a934ed 100644 --- a/apps/scandic-web/app/[lang]/(partner)/layout.tsx +++ b/apps/scandic-web/app/[lang]/(partner)/layout.tsx @@ -8,7 +8,6 @@ import Script from "next/script" import { Lang } from "@scandic-hotels/common/constants/language" -import { env } from "@/env/server" import TrpcProvider from "@/lib/trpc/Provider" import TokenRefresher from "@/components/Auth/TokenRefresher" @@ -32,9 +31,6 @@ export default async function RootLayout( const { children } = props - if (!env.SAS_ENABLED) { - return null - } setLang(params.lang) const messages = await getMessages(params.lang) diff --git a/apps/scandic-web/app/sitemap/[sitemapId]/route.ts b/apps/scandic-web/app/sitemap/[sitemapId]/route.ts index b42182aaf..0da6e4125 100644 --- a/apps/scandic-web/app/sitemap/[sitemapId]/route.ts +++ b/apps/scandic-web/app/sitemap/[sitemapId]/route.ts @@ -1,7 +1,5 @@ import { notFound } from "next/navigation" -import { env } from "@/env/server" - import { getSitemapDataById } from "@/utils/sitemap" import type { NextRequest } from "next/server" @@ -12,10 +10,6 @@ export async function GET( _request: NextRequest, context: { params: Promise<{ sitemapId: string }> } ) { - if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") { - return notFound() - } - const params = await context.params const sitemapId = params.sitemapId diff --git a/apps/scandic-web/app/sitemap/route.ts b/apps/scandic-web/app/sitemap/route.ts index 76042dbc2..54a1f7148 100644 --- a/apps/scandic-web/app/sitemap/route.ts +++ b/apps/scandic-web/app/sitemap/route.ts @@ -1,5 +1,3 @@ -import { notFound } from "next/navigation" - import { env } from "@/env/server" import { getLastUpdated, getSitemapIds } from "@/utils/sitemap" @@ -7,10 +5,6 @@ import { getLastUpdated, getSitemapIds } from "@/utils/sitemap" export const dynamic = "force-dynamic" export async function GET() { - if (env.NEW_SITE_LIVE_STATUS !== "ALL_LANGUAGES_LIVE") { - return notFound() - } - console.log(`[SITEMAP] Fetching sitemap`) const lastUpdated = await getLastUpdated() diff --git a/apps/scandic-web/components/Blocks/DynamicContent/SAS/LinkedAccounts/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/SAS/LinkedAccounts/index.tsx index 6598f69e7..ba77f1654 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/SAS/LinkedAccounts/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/SAS/LinkedAccounts/index.tsx @@ -10,7 +10,6 @@ import { SAS_EUROBONUS_TIER_TO_NAME_MAP, TIER_TO_FRIEND_MAP, } from "@/constants/membershipLevels" -import { env } from "@/env/server" import { getProfileWithExtendedPartnerData } from "@/lib/trpc/memoizedRequests" import SectionContainer from "@/components/Section/Container" @@ -36,10 +35,6 @@ export default async function SASLinkedAccount({ subtitle, link, }: Props) { - if (!env.SAS_ENABLED) { - return null - } - const intl = await getIntl() return ( diff --git a/apps/scandic-web/components/Blocks/DynamicContent/SAS/TransferPoints/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/SAS/TransferPoints/index.tsx index 752ef97ea..c392683a4 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/SAS/TransferPoints/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/SAS/TransferPoints/index.tsx @@ -23,7 +23,7 @@ export default async function SASTransferPoints({ subtitle, link, }: Props) { - if (!env.SAS_ENABLED || !env.SAS_POINT_TRANSFER_ENABLED) { + if (!env.SAS_POINT_TRANSFER_ENABLED) { return null } diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/EmptyUpcomingStays/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/EmptyUpcomingStays/index.tsx index a82c99763..4be2c43d3 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/EmptyUpcomingStays/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/EmptyUpcomingStays/index.tsx @@ -1,8 +1,5 @@ -import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import { env } from "@/env/server" - import Link from "@/components/TempDesignSystem/Link" import Title from "@/components/TempDesignSystem/Text/Title" import { getIntl } from "@/i18n" @@ -13,11 +10,8 @@ import styles from "./emptyUpcomingStays.module.css" export default async function EmptyUpcomingStaysBlock() { const intl = await getIntl() const lang = await getLang() - const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" - const href = !env.isLangLive(lang) - ? getCurrentWebUrl({ path: "/", lang, baseUrl }) - : `/${lang}` + const href = `/${lang}` return (
diff --git a/apps/scandic-web/components/Blocks/DynamicContent/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/index.tsx index b18be8432..5a5ffd8ae 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/index.tsx @@ -2,8 +2,6 @@ import { Suspense } from "react" import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent" -import { env } from "@/env/server" - import HowItWorks from "@/components/Blocks/DynamicContent/HowItWorks" import LoyaltyLevels from "@/components/Blocks/DynamicContent/LoyaltyLevels" import Overview from "@/components/Blocks/DynamicContent/Overview" @@ -41,9 +39,7 @@ function DynamicContentBlocks(props: DynamicContentProps) { case DynamicContentEnum.Blocks.components.earn_and_burn: return case DynamicContentEnum.Blocks.components.expiring_points: - return env.NEW_SITE_LIVE_STATUS === "NOT_LIVE" ? null : ( - - ) + return case DynamicContentEnum.Blocks.components.how_it_works: return case DynamicContentEnum.Blocks.components.jobylon_feed: diff --git a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/index.tsx b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/index.tsx index 9630f1836..e4326beb1 100644 --- a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/index.tsx +++ b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Desktop/index.tsx @@ -4,7 +4,6 @@ import { useCallback, useEffect, useRef, useState } from "react" import { languages } from "@/constants/languages" -import { env } from "@/env/client" import Link from "@/components/TempDesignSystem/Link" import useLang from "@/hooks/useLang" @@ -84,19 +83,11 @@ export default function Desktop({ urls }: LanguageSwitcherProps) { className={`${styles.li} ${currentLanguage === key ? styles.active : ""}`} > {urls[key as Lang]?.isExternal ? ( - + {languages[key as Lang]} ) : ( - + {languages[key as Lang]} )} diff --git a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/index.tsx b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/index.tsx index 08a96c8af..f514682f3 100644 --- a/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/index.tsx +++ b/apps/scandic-web/components/Current/Header/LanguageSwitcher/Mobile/index.tsx @@ -4,7 +4,6 @@ import { useState } from "react" import { languages } from "@/constants/languages" -import { env } from "@/env/client" import useLang from "@/hooks/useLang" @@ -47,11 +46,7 @@ export default function Mobile({ urls }: LanguageSwitcherProps) { if (url) { return (
  • - + {languages[key as Lang]}
  • diff --git a/apps/scandic-web/components/Footer/index.tsx b/apps/scandic-web/components/Footer/index.tsx index 4cff8bff9..8a7c0eaa5 100644 --- a/apps/scandic-web/components/Footer/index.tsx +++ b/apps/scandic-web/components/Footer/index.tsx @@ -1,9 +1,5 @@ -import { env } from "@/env/server" import { getFooter } from "@/lib/trpc/memoizedRequests" -import CurrentFooter from "@/components/Current/Footer" -import { getLang } from "@/i18n/serverContext" - import FooterDetails from "./Details" import FooterNavigation from "./Navigation" @@ -14,11 +10,6 @@ export function preload() { } export default async function Footer() { - const lang = await getLang() - if (!env.isLangLive(lang)) { - return - } - preload() return ( diff --git a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx index 45a58936b..be4de2b28 100644 --- a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx @@ -5,20 +5,14 @@ import { Dialog, Modal } from "react-aria-components" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" -import { - findMyBooking, - findMyBookingCurrentWebPath, -} from "@scandic-hotels/common/constants/routes/findMyBooking" -import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" +import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" import { customerService } from "@/constants/webHrefs" -import { env } from "@/env/client" import useDropdownStore from "@/stores/main-menu" import { IconName } from "@/components/Icons/iconName" import LanguageSwitcher from "@/components/LanguageSwitcher" import { useHandleKeyUp } from "@/hooks/useHandleKeyUp" -import { useIsLangLive } from "@/hooks/useIsLangLive" import useLang from "@/hooks/useLang" import HeaderLink from "../../HeaderLink" @@ -34,7 +28,6 @@ export default function MobileMenu({ topLink, isLoggedIn, }: React.PropsWithChildren) { - const isLangLive = useIsLangLive() const lang = useLang() const intl = useIntl() const { @@ -78,14 +71,7 @@ export default function MobileMenu({ defaultMessage: "Open menu", }) - const baseUrl = env.NEXT_PUBLIC_PUBLIC_URL || "https://www.scandichotels.com" - const findMyBookingUrl = !isLangLive - ? getCurrentWebUrl({ - path: findMyBookingCurrentWebPath[lang], - lang, - baseUrl, - }) - : findMyBooking[lang] + const findMyBookingUrl = findMyBooking[lang] return ( <> diff --git a/apps/scandic-web/components/Header/TopMenu/index.tsx b/apps/scandic-web/components/Header/TopMenu/index.tsx index b19fc6eb9..00cff3cb6 100644 --- a/apps/scandic-web/components/Header/TopMenu/index.tsx +++ b/apps/scandic-web/components/Header/TopMenu/index.tsx @@ -1,10 +1,5 @@ -import { - findMyBooking, - findMyBookingCurrentWebPath, -} from "@scandic-hotels/common/constants/routes/findMyBooking" -import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" +import { findMyBooking } from "@scandic-hotels/common/constants/routes/findMyBooking" -import { env } from "@/env/server" import { getHeader } from "@/lib/trpc/memoizedRequests" import { IconName } from "@/components/Icons/iconName" @@ -31,14 +26,7 @@ export default async function TopMenu() { } const lang = await getLang() - const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" - const findMyBookingUrl = !env.isLangLive(lang) - ? getCurrentWebUrl({ - path: findMyBookingCurrentWebPath[lang], - lang, - baseUrl, - }) - : findMyBooking[lang] + const findMyBookingUrl = findMyBooking[lang] return (
    diff --git a/apps/scandic-web/components/Header/index.tsx b/apps/scandic-web/components/Header/index.tsx index 9f989cc41..260ff2c69 100644 --- a/apps/scandic-web/components/Header/index.tsx +++ b/apps/scandic-web/components/Header/index.tsx @@ -1,12 +1,7 @@ import { Suspense } from "react" -import { env } from "@/env/server" import { getHeader, getName } from "@/lib/trpc/memoizedRequests" -import CurrentHeader from "@/components/Current/Header" -import { getLang } from "@/i18n/serverContext" - -import HeaderFallback from "../Current/Header/HeaderFallback" import MainMenu from "./MainMenu" import TopMenu, { TopMenuSkeleton } from "./TopMenu" @@ -14,16 +9,6 @@ import styles from "./header.module.css" export default async function Header() { void getName() - - const lang = await getLang() - if (!env.isLangLive(lang)) { - return ( - }> - - - ) - } - void getHeader() return ( diff --git a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx index 8229d346b..585bb3d81 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/index.tsx @@ -3,7 +3,6 @@ import { notFound } from "next/navigation" import { dt } from "@scandic-hotels/common/dt" import * as maskValue from "@scandic-hotels/common/utils/maskValue" -import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" import { Typography } from "@scandic-hotels/design-system/Typography" import { BreakfastPackageEnum } from "@scandic-hotels/trpc/enums/breakfast" import { parseRefId } from "@scandic-hotels/trpc/utils/refId" @@ -169,9 +168,7 @@ export default async function MyStay(props: { hotel.galleryImages[0]?.imageSizes.large const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" - const promoUrl = !env.isLangLive(lang) - ? new URL(getCurrentWebUrl({ path: "/", lang })) - : new URL(`${baseUrl}/${lang}/`) + const promoUrl = new URL(`${baseUrl}/${lang}/`) promoUrl.searchParams.set("hotel", hotel.operaId) diff --git a/apps/scandic-web/components/LanguageSwitcher/LanguageSwitcherContent/index.tsx b/apps/scandic-web/components/LanguageSwitcher/LanguageSwitcherContent/index.tsx index d8594c0eb..d2682859c 100644 --- a/apps/scandic-web/components/LanguageSwitcher/LanguageSwitcherContent/index.tsx +++ b/apps/scandic-web/components/LanguageSwitcher/LanguageSwitcherContent/index.tsx @@ -7,7 +7,6 @@ import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" import { languages } from "@/constants/languages" -import { env } from "@/env/client" import Link from "@/components/TempDesignSystem/Link" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" @@ -57,7 +56,6 @@ export default function LanguageSwitcherContent({ onLanguageSwitch(key)} variant="languageSwitcher" keepSearchParams diff --git a/apps/scandic-web/env/client.ts b/apps/scandic-web/env/client.ts index 01974bea7..f673282a0 100644 --- a/apps/scandic-web/env/client.ts +++ b/apps/scandic-web/env/client.ts @@ -1,24 +1,12 @@ import { createEnv } from "@t3-oss/env-nextjs" import { z } from "zod" -import { getLiveStatus } from "./getLiveStatus" -import { isLangLive } from "./isLangLive" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -const _env = createEnv({ +export const env = createEnv({ client: { NEXT_PUBLIC_NODE_ENV: z.enum(["development", "test", "production"]), NEXT_PUBLIC_PORT: z.string().default("3000"), NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().default("development"), NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.001), - NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS: z - .string() - .regex(/^([a-z]{2},)*([a-z]{2}){0,1}$/) - .transform((val) => { - return val.split(",") - }) - .default(""), NEXT_PUBLIC_PUBLIC_URL: z.string().optional(), }, emptyStringAsUndefined: true, @@ -28,15 +16,6 @@ const _env = createEnv({ NEXT_PUBLIC_SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: process.env.NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE, - NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS: - process.env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS, NEXT_PUBLIC_PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, }, }) - -export const env = { - ..._env, - NEW_SITE_LIVE_STATUS: getLiveStatus(_env), - isLangLive: (lang: Lang) => - isLangLive(lang, _env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS), -} diff --git a/apps/scandic-web/env/getLiveStatus.ts b/apps/scandic-web/env/getLiveStatus.ts deleted file mode 100644 index 287b8680c..000000000 --- a/apps/scandic-web/env/getLiveStatus.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Lang } from "@scandic-hotels/common/constants/language" - -export function getLiveStatus( - internalEnv: - | { - NEW_SITE_LIVE_FOR_LANGS: string[] - } - | { - NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS: string[] - } -): "ALL_LANGUAGES_LIVE" | "SOME_LANGUAGES_LIVE" | "NOT_LIVE" { - const configuredLangs = getConfiguredLangs(internalEnv) - if (!configuredLangs) { - return "NOT_LIVE" - } - - const allLangs = Object.keys(Lang) - const liveLangs = allLangs.filter((lang) => configuredLangs.includes(lang)) - if (liveLangs.length === 0) { - return "NOT_LIVE" - } - - if ( - liveLangs.length === allLangs.length && - allLangs.every((lang) => liveLangs.includes(lang)) - ) { - return "ALL_LANGUAGES_LIVE" - } - - return "SOME_LANGUAGES_LIVE" -} - -function getConfiguredLangs(env: T): string[] | undefined { - if ( - !( - "NEW_SITE_LIVE_FOR_LANGS" in env || - "NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS" in env - ) - ) { - return undefined - } - - const configuredLangs = - "NEW_SITE_LIVE_FOR_LANGS" in env - ? env.NEW_SITE_LIVE_FOR_LANGS - : env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS - - if (!Array.isArray(configuredLangs)) { - throw new Error("Misconfigured environment variable, expected array") - } - - return configuredLangs -} diff --git a/apps/scandic-web/env/isLangLive.test.ts b/apps/scandic-web/env/isLangLive.test.ts deleted file mode 100644 index 9e5956efd..000000000 --- a/apps/scandic-web/env/isLangLive.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { describe, expect, it } from "@jest/globals" - -import { Lang } from "@scandic-hotels/common/constants/language" - -import { isLangLive } from "./isLangLive" - -describe("hideForNextRelease", () => { - it("should return true if en is part of live languages", () => { - expect(isLangLive(Lang.en, ["en", "sv"])).toBe(true) - expect(isLangLive(Lang.en, ["en"])).toBe(true) - }) - - it("should return false if en is not part of live languages", () => { - expect(isLangLive(Lang.en, [])).toBe(false) - expect(isLangLive(Lang.en, ["sv"])).toBe(false) - expect(isLangLive(Lang.en, ["sv,fi"])).toBe(false) - }) -}) diff --git a/apps/scandic-web/env/isLangLive.ts b/apps/scandic-web/env/isLangLive.ts deleted file mode 100644 index 2a985f3fa..000000000 --- a/apps/scandic-web/env/isLangLive.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Lang } from "@scandic-hotels/common/constants/language" - -export function isLangLive(lang: Lang, liveLangs: string[]): boolean { - return liveLangs.includes(lang) -} diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index 5f162ea9e..79b65c824 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -1,14 +1,9 @@ import { createEnv } from "@t3-oss/env-nextjs" import { z } from "zod" -import { getLiveStatus } from "./getLiveStatus" -import { isLangLive } from "./isLangLive" - -import type { Lang } from "@scandic-hotels/common/constants/language" - const TWENTYFOUR_HOURS = 24 * 60 * 60 -const _env = createEnv({ +export const env = createEnv({ /** * Due to t3-env only checking typeof window === "undefined" * and Netlify running Deno, window is never "undefined" @@ -112,13 +107,6 @@ const _env = createEnv({ GOOGLE_STATIC_MAP_SIGNATURE_SECRET: z.string(), GOOGLE_DYNAMIC_MAP_ID: z.string(), GOOGLE_STATIC_MAP_ID: z.string(), - ENABLE_BOOKING_WIDGET: z - .string() - // only allow "true" or "false" - .refine((s) => s === "true" || s === "false") - // transform to boolean - .transform((s) => s === "true") - .default("false"), ENABLE_SURPRISES: z .string() // only allow "true" or "false" @@ -155,11 +143,6 @@ const _env = createEnv({ SAS_AUTH_ENDPOINT: z.string().default(""), SAS_OCP_APIM: z.string().default(""), SAS_AUTH_CLIENTID: z.string().default(""), - SAS_ENABLED: z - .string() - .refine((s) => s === "1" || s === "0") - .transform((s) => s === "1") - .default("0"), SAS_POINT_TRANSFER_ENABLED: z .string() // only allow "true" or "false" @@ -192,17 +175,6 @@ const _env = createEnv({ .transform((s) => s === "true") .default("true"), WARMUP_TOKEN: z.string().optional(), - /** - * Include the languages that should be hidden for the next release - * Should be in the format of "en,da,de,fi,no,sv" or empty - */ - NEW_SITE_LIVE_FOR_LANGS: z - .string() - .regex(/^([a-z]{2},)*([a-z]{2}){0,1}$/) - .transform((val) => { - return val.split(",") - }) - .default(""), DTMC_ENTRA_ID_CLIENT: z.string(), DTMC_ENTRA_ID_ISSUER: z.string(), /** @@ -284,7 +256,6 @@ const _env = createEnv({ GOOGLE_STATIC_MAP_ID: process.env.GOOGLE_STATIC_MAP_ID, GOOGLE_DYNAMIC_MAP_ID: process.env.GOOGLE_DYNAMIC_MAP_ID, USE_NEW_REWARD_MODEL: process.env.USE_NEW_REWARD_MODEL, - ENABLE_BOOKING_WIDGET: process.env.ENABLE_BOOKING_WIDGET, ENABLE_SURPRISES: process.env.ENABLE_SURPRISES, ENABLE_DTMC: process.env.ENABLE_DTMC, SHOW_SITE_WIDE_ALERT: process.env.SHOW_SITE_WIDE_ALERT, @@ -295,7 +266,6 @@ const _env = createEnv({ SAS_AUTH_ENDPOINT: process.env.SAS_AUTH_ENDPOINT, SAS_OCP_APIM: process.env.SAS_OCP_APIM, SAS_AUTH_CLIENTID: process.env.SAS_AUTH_CLIENTID, - SAS_ENABLED: process.env.SAS, SAS_POINT_TRANSFER_ENABLED: process.env.SAS_POINT_TRANSFER_ENABLED, CACHE_TIME_HOTELS: process.env.CACHE_TIME_HOTELS, @@ -307,7 +277,6 @@ const _env = createEnv({ GIT_SHA: process.env.GIT_SHA, ENABLE_WARMUP_HOTEL: process.env.ENABLE_WARMUP_HOTEL, WARMUP_TOKEN: process.env.WARMUP_TOKEN, - NEW_SITE_LIVE_FOR_LANGS: process.env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS, DTMC_ENTRA_ID_CLIENT: process.env.DTMC_ENTRA_ID_CLIENT, DTMC_ENTRA_ID_ISSUER: process.env.DTMC_ENTRA_ID_ISSUER, @@ -316,12 +285,6 @@ const _env = createEnv({ }, }) -export const env = { - ..._env, - NEW_SITE_LIVE_STATUS: getLiveStatus(_env), - isLangLive: (lang: Lang) => isLangLive(lang, _env.NEW_SITE_LIVE_FOR_LANGS), -} as const - function replaceTopLevelDomain(url: string, domain: string) { return url.replaceAll("{topleveldomain}", domain) } diff --git a/apps/scandic-web/hooks/useIsLangLive.ts b/apps/scandic-web/hooks/useIsLangLive.ts deleted file mode 100644 index 87a254b42..000000000 --- a/apps/scandic-web/hooks/useIsLangLive.ts +++ /dev/null @@ -1,10 +0,0 @@ -"use client" - -import { env } from "@/env/client" - -import useLang from "./useLang" - -export function useIsLangLive(): boolean { - const lang = useLang() - return env.isLangLive(lang) -} diff --git a/apps/scandic-web/hooks/useStickyPosition.ts b/apps/scandic-web/hooks/useStickyPosition.ts index 483e11fca..4186bca4b 100644 --- a/apps/scandic-web/hooks/useStickyPosition.ts +++ b/apps/scandic-web/hooks/useStickyPosition.ts @@ -9,8 +9,6 @@ import useStickyPositionStore, { import { debounce } from "@/utils/debounce" -import { useIsLangLive } from "./useIsLangLive" - interface UseStickyPositionProps { ref?: React.RefObject name?: StickyElementNameEnum @@ -47,7 +45,6 @@ export default function useStickyPosition({ getAllElements, } = useStickyPositionStore() - const isLangLive = useIsLangLive() /* Used for Current mobile header since that doesn't use this hook. * * Instead, calculate if the mobile header is shown and add the height of @@ -125,12 +122,10 @@ export default function useStickyPosition({ updateHeights() // Only do this special handling if we have the current header - if (!isLangLive) { - if (document.body.clientWidth > 950) { - setBaseTopOffset(0) - } else { - setBaseTopOffset(52.41) // The height of current mobile header - } + if (document.body.clientWidth > 950) { + setBaseTopOffset(0) + } else { + setBaseTopOffset(52.41) // The height of current mobile header } }, 100) @@ -144,7 +139,7 @@ export default function useStickyPosition({ resizeObserver.unobserve(document.body) } } - }, [updateHeights, isLangLive]) + }, [updateHeights]) return { currentHeight: ref?.current?.offsetHeight || null, diff --git a/apps/scandic-web/utils/metadata/generateMetadata.ts b/apps/scandic-web/utils/metadata/generateMetadata.ts index 87c18327e..a7b952866 100644 --- a/apps/scandic-web/utils/metadata/generateMetadata.ts +++ b/apps/scandic-web/utils/metadata/generateMetadata.ts @@ -7,7 +7,6 @@ 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" @@ -20,12 +19,10 @@ import type { export async function generateMetadata({ searchParams, - params, }: PageArgs< LangParams & ContentTypeParams & UIDParams, { subpage?: string; filterFromUrl?: string } >) { - const { lang } = await params const { subpage, filterFromUrl, ...otherSearchParams } = await searchParams // If there are other (real) search params, we don't want to index the page as this will // cause duplicate content issues. @@ -41,8 +38,8 @@ export async function generateMetadata({ if (!rawMetadata) { return { robots: { - index: env.isLangLive(lang), - follow: env.isLangLive(lang), + index: true, + follow: true, }, } } @@ -57,15 +54,14 @@ export async function generateMetadata({ ...metadata, robots: { ...(metadata.robots ?? {}), - index: isIndexable(metadata.robots?.index, lang, alternates), - follow: isIndexable(metadata.robots?.follow, lang, alternates), + index: isIndexable(metadata.robots?.index, alternates), + follow: isIndexable(metadata.robots?.follow, alternates), }, } } function isIndexable( pageIndexableFromSettings: boolean | null | undefined, - lang: Lang, alternates: AlternateURLs | null ) { // This is a special case for whitelisting the scandic friends pages, this can be removed when all pages are live @@ -76,7 +72,7 @@ function isIndexable( } // If we are live we want to index the page, but if the page has been marked as noindex in contentstack we don't - return (pageIndexableFromSettings ?? true) && env.isLangLive(lang) + return pageIndexableFromSettings ?? true } function getUrl(alternates: AlternateURLs | null): string | null { diff --git a/packages/trpc/env/server.ts b/packages/trpc/env/server.ts index 5c3929bb5..36b752b2f 100644 --- a/packages/trpc/env/server.ts +++ b/packages/trpc/env/server.ts @@ -25,11 +25,6 @@ const _env = createEnv({ SAS_AUTH_ENDPOINT: z.string().default(""), SAS_OCP_APIM: z.string().default(""), SAS_AUTH_CLIENTID: z.string().default(""), - SAS_ENABLED: z - .string() - .refine((s) => s === "1" || s === "0") - .transform((s) => s === "1") - .default("0"), CACHE_TIME_HOTELS: z.coerce .number() .default(TWENTYFOUR_HOURS) @@ -74,7 +69,6 @@ const _env = createEnv({ SAS_AUTH_ENDPOINT: process.env.SAS_AUTH_ENDPOINT, SAS_OCP_APIM: process.env.SAS_OCP_APIM, SAS_AUTH_CLIENTID: process.env.SAS_AUTH_CLIENTID, - SAS_ENABLED: process.env.SAS, CACHE_TIME_HOTELS: process.env.CACHE_TIME_HOTELS, CACHE_TIME_CITY_SEARCH: process.env.CACHE_TIME_CITY_SEARCH, NODE_ENV: process.env.NODE_ENV, diff --git a/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts b/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts index 971187b21..3e13c526a 100644 --- a/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts +++ b/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts @@ -3,7 +3,6 @@ import { cache } from "react" import * as routes from "@scandic-hotels/common/constants/routes/myPages" import { safeTry } from "@scandic-hotels/common/utils/safeTry" -import { env } from "../../../../env/server" import { getEurobonusMembership } from "../../user/helpers" import type { Lang } from "@scandic-hotels/common/constants/language" @@ -67,9 +66,7 @@ export const getPrimaryLinks = cache( const isScandicXSASActive = (loyalty: UserLoyalty) => { const eurobonusMembership = getEurobonusMembership(loyalty) - const isLinked = Boolean(eurobonusMembership) - - return env.SAS_ENABLED && isLinked + return Boolean(eurobonusMembership) } const showTeamMemberCard = cache(async () => { diff --git a/packages/trpc/lib/routers/user/utils.ts b/packages/trpc/lib/routers/user/utils.ts index 2f5f95e41..4afd34842 100644 --- a/packages/trpc/lib/routers/user/utils.ts +++ b/packages/trpc/lib/routers/user/utils.ts @@ -2,7 +2,6 @@ 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 maskValue from "@scandic-hotels/common/utils/maskValue" -import { getCurrentWebUrl } from "@scandic-hotels/common/utils/url" import { env } from "../../../env/server" import * as api from "../../api" @@ -340,15 +339,7 @@ export async function updateStaysBookingUrl( const baseUrl = env.PUBLIC_URL || "https://www.scandichotels.com" // Construct Booking URL. - const bookingUrl = !env.isLangLive(lang) - ? new URL( - getCurrentWebUrl({ - path: myBookingPath[lang], - lang, - baseUrl, - }) - ) - : new URL(myStay[lang], baseUrl) + const bookingUrl = new URL(myStay[lang], baseUrl) // Add search parameters. if (encryptedBookingValue) {