) {
- 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) {