diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 02ea34749..f3db807d2 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -52,4 +52,3 @@ DTMC_ENTRA_ID_CLIENT="" DTMC_ENTRA_ID_ISSUER="" DTMC_ENTRA_ID_SECRET="" -NEW_STAYS_ON_MY_PAGES="true" diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/NextStay/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/NextStay/index.tsx index e3c404a5e..8f0554576 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/NextStay/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/NextStay/index.tsx @@ -1,4 +1,3 @@ -import { env } from "@/env/server" import { serverClient } from "@/lib/trpc/server" import { Section } from "@/components/Section" @@ -17,7 +16,7 @@ export default async function NextStay({ title, link }: NextStayProps) { const nextStay = await caller.user.stays.next() if (!nextStay) { - return env.NEW_STAYS_ON_MY_PAGES ? : null + return } return ( diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/index.tsx deleted file mode 100644 index 6e2116a7e..000000000 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/index.tsx +++ /dev/null @@ -1,76 +0,0 @@ -"use client" - -import { dt } from "@scandic-hotels/common/dt" -import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import Image from "@scandic-hotels/design-system/Image" -import Link from "@scandic-hotels/design-system/OldDSLink" -import { Typography } from "@scandic-hotels/design-system/Typography" - -import useLang from "@/hooks/useLang" - -import styles from "./stay.module.css" - -import type { StayCardProps } from "@/types/components/myPages/stays/stayCard" - -export default function OldStayCard({ stay }: StayCardProps) { - const { bookingUrl, isWebAppOrigin } = stay.attributes - - const shouldLinkToMyStay = isWebAppOrigin - - if (!shouldLinkToMyStay) { - return - } - - return ( - - - - ) -} - -function CardContent({ stay }: StayCardProps) { - const lang = useLang() - - const { checkinDate, checkoutDate, hotelInformation } = stay.attributes - - const arrival = dt(checkinDate).locale(lang) - const arrivalDate = arrival.format("DD MMM") - const arrivalDateTime = arrival.format("YYYY-MM-DD") - const depart = dt(checkoutDate).locale(lang) - const departDate = depart.format("DD MMM YYYY") - const departDateTime = depart.format("YYYY-MM-DD") - - return ( -
- { -
- -

{hotelInformation.hotelName}

-
-
- - -

- - {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} - {" - "} - -

-
-
-
-
- ) -} diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/stay.module.css b/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/stay.module.css deleted file mode 100644 index 2f1cfcea0..000000000 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/OldStayCard/stay.module.css +++ /dev/null @@ -1,44 +0,0 @@ -.link { - outline: 1px solid var(--Base-Border-Subtle); - border-radius: var(--Corner-Radius-md); - overflow: hidden; - - &:focus, - &:hover { - outline-offset: 0; - outline: 1.5px solid var(--Base-Border-Hover); - } -} - -.stay { - background-color: var(--Main-Grey-White); -} - -.image { - min-height: 220px; - object-fit: cover; - overflow: hidden; - width: 100%; -} - -.footer { - color: var(--Scandic-Brand-Burgundy); - display: grid; - gap: var(--Space-x2); - margin-top: auto; - overflow: hidden; - padding: var(--Space-x2); - width: 100%; -} - -.hotel { - overflow: hidden; - text-overflow: ellipsis; - text-wrap: nowrap; -} - -.date { - align-items: center; - display: flex; - gap: var(--Space-x05); -} diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/OldClient.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/OldClient.tsx deleted file mode 100644 index dadfa8906..000000000 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/OldClient.tsx +++ /dev/null @@ -1,65 +0,0 @@ -"use client" - -import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" -import { ShowMoreButton } from "@scandic-hotels/design-system/ShowMoreButton" -import { trpc } from "@scandic-hotels/trpc/client" - -import Grids from "@/components/TempDesignSystem/Grids" -import useLang from "@/hooks/useLang" - -import ListContainer from "../ListContainer" -import OldStayCard from "../OldStayCard" - -import type { - PreviousStaysClientProps, - PreviousStaysNonNullResponseObject, -} from "@/types/components/myPages/stays/previous" - -export function ClientPreviousStays({ - initialPreviousStays, -}: PreviousStaysClientProps) { - const lang = useLang() - const { data, isFetching, fetchNextPage, hasNextPage, isLoading } = - trpc.user.stays.previous.useInfiniteQuery( - { - limit: 6, - lang, - }, - { - getNextPageParam: (lastPage) => { - return lastPage?.nextCursor - }, - initialData: { - pageParams: [undefined, 1], - pages: [initialPreviousStays], - }, - } - ) - - if (isLoading) { - return - } - - function loadMoreData() { - if (hasNextPage) { - fetchNextPage() - } - } - - const stays = data.pages - .filter((page): page is PreviousStaysNonNullResponseObject => !!page?.data) - .flatMap((page) => page.data) - - return ( - - - {stays.map((stay) => ( - - ))} - - {hasNextPage ? ( - - ) : null} - - ) -} diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx index b93701339..7949c6091 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Previous/index.tsx @@ -1,4 +1,3 @@ -import { env } from "@/env/server" import { serverClient } from "@/lib/trpc/server" import ClaimPoints from "@/components/Blocks/DynamicContent/Points/ClaimPoints" @@ -9,7 +8,6 @@ import SectionLink from "@/components/Section/Link" import { Cards } from "./Cards" import { INITIAL_STAYS_FETCH_LIMIT } from "./data" import { L6Progress } from "./L6Progress" -import { ClientPreviousStays } from "./OldClient" import styles from "./previous.module.css" @@ -28,16 +26,14 @@ export default async function PreviousStays({ return null } - const StaysComponent = env.NEW_STAYS_ON_MY_PAGES ? Cards : ClientPreviousStays - return (
- {env.NEW_STAYS_ON_MY_PAGES ? : null} - + +
) diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/EmptyUpcomingStays/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/EmptyUpcomingStays/index.tsx index ea62e3bed..93071980e 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/EmptyUpcomingStays/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/EmptyUpcomingStays/index.tsx @@ -1,10 +1,6 @@ import ButtonLink from "@scandic-hotels/design-system/ButtonLink" -import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" -import Link from "@scandic-hotels/design-system/OldDSLink" import { Typography } from "@scandic-hotels/design-system/Typography" -import { env } from "@/env/server" - import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" @@ -16,40 +12,6 @@ export default async function EmptyUpcomingStays() { const href = `/${lang}` - if (!env.NEW_STAYS_ON_MY_PAGES) { - return ( -
-
- -

- {intl.formatMessage({ - id: "stays.noUpcomingStays", - defaultMessage: "You have no upcoming stays.", - })} - - {intl.formatMessage({ - id: "stays.whereToGoNext", - defaultMessage: "Where should you go next?", - })} - -

-
-
- - {intl.formatMessage({ - id: "stays.getInspired", - defaultMessage: "Get inspired", - })} - - -
- ) - } - return (
diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/OldClient.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/OldClient.tsx deleted file mode 100644 index 7b894a8f3..000000000 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/OldClient.tsx +++ /dev/null @@ -1,65 +0,0 @@ -"use client" - -import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner" -import { ShowMoreButton } from "@scandic-hotels/design-system/ShowMoreButton" -import { trpc } from "@scandic-hotels/trpc/client" - -import Grids from "@/components/TempDesignSystem/Grids" -import useLang from "@/hooks/useLang" - -import ListContainer from "../ListContainer" -import OldStayCard from "../OldStayCard" - -import type { - UpcomingStaysClientProps, - UpcomingStaysNonNullResponseObject, -} from "@/types/components/myPages/stays/upcoming" - -export default function ClientUpcomingStays({ - initialUpcomingStays, -}: UpcomingStaysClientProps) { - const lang = useLang() - const { data, isFetching, fetchNextPage, hasNextPage, isLoading } = - trpc.user.stays.upcoming.useInfiniteQuery( - { - limit: 6, - lang, - }, - { - getNextPageParam: (lastPage) => { - return lastPage?.nextCursor - }, - initialData: { - pageParams: [undefined, 1], - pages: [initialUpcomingStays], - }, - } - ) - - if (isLoading) { - return - } - - function loadMoreData() { - if (hasNextPage) { - fetchNextPage() - } - } - - const stays = data.pages - .filter((page): page is UpcomingStaysNonNullResponseObject => !!page?.data) - .flatMap((page) => page.data) - - return stays.length ? ( - - - {stays.map((stay) => ( - - ))} - - {hasNextPage ? ( - - ) : null} - - ) : null -} diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/index.tsx index b696d81ca..778ca208a 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/Upcoming/index.tsx @@ -1,4 +1,3 @@ -import { env } from "@/env/server" import { serverClient } from "@/lib/trpc/server" import { Section } from "@/components/Section" @@ -6,8 +5,6 @@ import { SectionHeader } from "@/components/Section/Header" import SectionLink from "@/components/Section/Link" import UpcomingStaysCarousel from "./Carousel" -import EmptyUpcomingStays from "./EmptyUpcomingStays" -import ClientUpcomingStays from "./OldClient" import styles from "./upcoming.module.css" @@ -25,26 +22,12 @@ export default async function UpcomingStays({ const hasStays = initialUpcomingStays?.data && initialUpcomingStays.data.length > 0 - if (env.NEW_STAYS_ON_MY_PAGES) { - if (!hasStays) return null - - return ( -
- {title && } - - -
- ) - } + if (!hasStays) return null return (
{title && } - {hasStays ? ( - - ) : ( - - )} +
) diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index 591674482..ce28025b1 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -91,13 +91,6 @@ export const env = createEnv({ .string() .optional() .transform((s) => s?.split(",") || []), - NEW_STAYS_ON_MY_PAGES: z - .string() - // only allow "true" or "false" - .refine((s) => s === "true" || s === "false") - // transform to boolean - .transform((s) => s === "true") - .default("false"), SEO_INERT: z .string() .refine((s) => s === "1" || s === "0") @@ -166,7 +159,6 @@ export const env = createEnv({ DTMC_ENTRA_ID_ISSUER: process.env.DTMC_ENTRA_ID_ISSUER, DTMC_ENTRA_ID_SECRET: process.env.DTMC_ENTRA_ID_SECRET, CHATBOT_LIVE_LANGS: process.env.CHATBOT_LIVE_LANGS, - NEW_STAYS_ON_MY_PAGES: process.env.NEW_STAYS_ON_MY_PAGES, SEO_INERT: process.env.SEO_INERT, ENABLE_PROFILE_CONSENT: process.env.ENABLE_PROFILE_CONSENT, RELEASE_TAG: process.env.NEXT_PUBLIC_RELEASE_TAG, diff --git a/packages/trpc/env/server.ts b/packages/trpc/env/server.ts index e2567bf77..4cd42a0d5 100644 --- a/packages/trpc/env/server.ts +++ b/packages/trpc/env/server.ts @@ -36,13 +36,6 @@ export const env = createEnv({ SENTRY_ENVIRONMENT: z.string().default("development"), PUBLIC_URL: z.string().default(""), SALESFORCE_PREFERENCE_BASE_URL: z.string(), - NEW_STAYS_ON_MY_PAGES: z - .string() - // only allow "true" or "false" - .refine((s) => s === "true" || s === "false") - // transform to boolean - .transform((s) => s === "true") - .default("false"), }, emptyStringAsUndefined: true, runtimeEnv: { @@ -63,6 +56,5 @@ export const env = createEnv({ SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT, PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, SALESFORCE_PREFERENCE_BASE_URL: process.env.SALESFORCE_PREFERENCE_BASE_URL, - NEW_STAYS_ON_MY_PAGES: process.env.NEW_STAYS_ON_MY_PAGES, }, }) diff --git a/packages/trpc/lib/routers/user/query/index.ts b/packages/trpc/lib/routers/user/query/index.ts index 43cd7dfce..065d7f357 100644 --- a/packages/trpc/lib/routers/user/query/index.ts +++ b/packages/trpc/lib/routers/user/query/index.ts @@ -2,7 +2,6 @@ import { BALFWD } from "@scandic-hotels/common/constants/transactionType" import { createCounter } from "@scandic-hotels/common/telemetry" import { safeTry } from "@scandic-hotels/common/utils/safeTry" -import { env } from "../../../../env/server" import { router } from "../../.." import * as api from "../../../api" import { Transactions } from "../../../enums/transactions" @@ -186,30 +185,23 @@ export const userQueryRouter = router({ language ) - if (env.NEW_STAYS_ON_MY_PAGES) { - // When includeFirstStay is true (used by SidePeek), return all stays - if (includeFirstStay) { - return { - data: updatedData, - nextCursor, - } - } - - if (updatedData.length <= 1) { - // If there are 1 or fewer stays, return null since NextStay handles this - return null - } - - // If there are multiple stays, filter out the first one since NextStay shows it - const filteredData = updatedData.slice(1) + // When includeFirstStay is true (used by SidePeek), return all stays + if (includeFirstStay) { return { - data: filteredData, + data: updatedData, nextCursor, } } + if (updatedData.length <= 1) { + // If there are 1 or fewer stays, return null since NextStay handles this + return null + } + + // If there are multiple stays, filter out the first one since NextStay shows it + const filteredData = updatedData.slice(1) return { - data: updatedData, + data: filteredData, nextCursor, } }