diff --git a/apps/partner-sas/package.json b/apps/partner-sas/package.json index 4003ff1df..f56bcc11f 100644 --- a/apps/partner-sas/package.json +++ b/apps/partner-sas/package.json @@ -34,6 +34,7 @@ "eslint-plugin-formatjs": "^5.3.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-simple-import-sort": "^12.1.1", + "graphql-tag": "^2.12.6", "typescript": "5.8.3", "typescript-plugin-css-modules": "^5.1.0" }, diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx index 92b3c7318..e4ee94763 100644 --- a/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx +++ b/apps/scandic-web/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx @@ -1,6 +1,6 @@ import { notFound } from "next/navigation" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { combineRegExps, rateTypeRegex } from "@/constants/booking" @@ -24,7 +24,7 @@ export default async function SelectRatePage( if (!booking) return notFound() const isMultiRoom = booking.rooms.length > 1 - const isRedemption = booking.searchType === REDEMPTION + const isRedemption = booking.searchType === SEARCH_TYPE_REDEMPTION const isArbOrVoucher = booking.bookingCode ? singleRoomRateTypes.test(booking.bookingCode) : false diff --git a/apps/scandic-web/components/BookingWidget/Client.tsx b/apps/scandic-web/components/BookingWidget/Client.tsx index db92f302d..da0fe590b 100644 --- a/apps/scandic-web/components/BookingWidget/Client.tsx +++ b/apps/scandic-web/components/BookingWidget/Client.tsx @@ -7,7 +7,7 @@ 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 "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { trpc } from "@/lib/trpc/client" import { StickyElementNameEnum } from "@/stores/sticky-position" @@ -123,7 +123,7 @@ export default function BookingWidgetClient({ value: selectedBookingCode, remember: false, }, - redemption: data.searchType === REDEMPTION, + redemption: data.searchType === SEARCH_TYPE_REDEMPTION, rooms: defaultRoomsData, city: data.city || undefined, hotel: hotelId, diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx index cb3b9139c..ff4dc3156 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx @@ -6,7 +6,7 @@ import { useMediaQuery } from "usehooks-ts" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import Modal from "@/components/Modal" import Button from "@/components/TempDesignSystem/Button" @@ -65,11 +65,11 @@ export default function BookingCode() { shouldDirty: true, }) - if (getValues(REDEMPTION)) { + if (getValues(SEARCH_TYPE_REDEMPTION)) { // Remove the redemption as user types booking code and show notification for the same // Add delay to handle table mode rendering setTimeout(function () { - setValue(REDEMPTION, false, { + setValue(SEARCH_TYPE_REDEMPTION, false, { shouldValidate: true, shouldDirty: true, }) @@ -321,7 +321,7 @@ export function RemoveExtraRooms({ ...props }: ButtonProps) { const rooms = getValues("rooms")[0] setValue("rooms", [rooms], { shouldValidate: true, shouldDirty: true }) trigger("bookingCode.value") - trigger(REDEMPTION) + trigger(SEARCH_TYPE_REDEMPTION) }, 300) } diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/RewardNight/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/RewardNight/index.tsx index 4efa7afa9..03e2884d5 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/RewardNight/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/RewardNight/index.tsx @@ -7,7 +7,7 @@ import { useMediaQuery } from "usehooks-ts" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import Modal from "@/components/Modal" import Button from "@/components/TempDesignSystem/Button" @@ -38,26 +38,26 @@ export default function RewardNight() { defaultMessage: "To book a reward night, make sure you're logged in to your Scandic Friends account.", }) - const redemptionErr = errors[REDEMPTION] + const redemptionErr = errors[SEARCH_TYPE_REDEMPTION] const isDesktop = useMediaQuery("(min-width: 767px)") function validateRedemption(value: boolean) { // Validate redemption as per the rules defined in the schema - trigger(REDEMPTION) + trigger(SEARCH_TYPE_REDEMPTION) if (value && getValues("bookingCode.value")) { setValue("bookingCode.flag", false) setValue("bookingCode.value", "", { shouldValidate: true }) // Hide the notification popup after 5 seconds by re-triggering validation // This is kept consistent with location search field error notification timeout setTimeout(() => { - trigger(REDEMPTION) + trigger(SEARCH_TYPE_REDEMPTION) }, 5000) } } const resetOnMultiroomError = useCallback(() => { if (isMultiRoomError(redemptionErr?.message) && isDesktop) { - setValue(REDEMPTION, false, { shouldValidate: true }) + setValue(SEARCH_TYPE_REDEMPTION, false, { shouldValidate: true }) } }, [redemptionErr?.message, setValue, isDesktop]) @@ -85,7 +85,7 @@ export default function RewardNight() {
closeOnBlur(e.nativeEvent)}> { validateRedemption(e.target.value) diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx index 8e4044bef..c16a5b035 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/index.tsx @@ -7,7 +7,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" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { hotelreservation } from "@/constants/routes/hotelReservation" @@ -111,7 +111,7 @@ export default function FormContent({
{isMultiRoomError(errors.bookingCode?.value?.message) || - isMultiRoomError(errors[REDEMPTION]?.message) ? ( + isMultiRoomError(errors[SEARCH_TYPE_REDEMPTION]?.message) ? (
diff --git a/apps/scandic-web/components/Forms/BookingWidget/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/index.tsx index 106eac5db..232270564 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/index.tsx @@ -6,7 +6,7 @@ import { Form as FormRAC } from "react-aria-components" import { useFormContext } from "react-hook-form" import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReservation" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { selectHotel, @@ -60,7 +60,7 @@ export default function Form({ type, onClose }: BookingWidgetFormProps) { ? { bookingCode: data.bookingCode.value } : {}), // Followed current url structure to keep searchtype=redemption param incase of reward night - ...(data.redemption ? { searchType: REDEMPTION } : {}), + ...(data.redemption ? { searchType: SEARCH_TYPE_REDEMPTION } : {}), }) onClose() diff --git a/apps/scandic-web/components/Forms/BookingWidget/schema.ts b/apps/scandic-web/components/Forms/BookingWidget/schema.ts index 65211c14b..571827e0c 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/schema.ts +++ b/apps/scandic-web/components/Forms/BookingWidget/schema.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" export const bookingWidgetErrors = { @@ -104,7 +104,7 @@ export const bookingWidgetSchema = z ctx.addIssue({ code: z.ZodIssueCode.custom, message: bookingWidgetErrors.MULTIROOM_REWARD_NIGHT_UNAVAILABLE, - path: [REDEMPTION], + path: [SEARCH_TYPE_REDEMPTION], }) ctx.addIssue({ code: z.ZodIssueCode.custom, @@ -116,7 +116,7 @@ export const bookingWidgetSchema = z ctx.addIssue({ code: z.ZodIssueCode.custom, message: bookingWidgetErrors.CODE_VOUCHER_REWARD_NIGHT_UNAVAILABLE, - path: [REDEMPTION], + path: [SEARCH_TYPE_REDEMPTION], }) ctx.addIssue({ code: z.ZodIssueCode.custom, diff --git a/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx b/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx index 84744f2a0..9ca0780e9 100644 --- a/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx +++ b/apps/scandic-web/components/GuestsRoomsPicker/Form.tsx @@ -6,7 +6,7 @@ import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" import { Typography } from "@scandic-hotels/design-system/Typography" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import Button from "../TempDesignSystem/Button" import { Tooltip } from "../TempDesignSystem/Tooltip" @@ -39,7 +39,7 @@ export default function GuestsRoomsPickerDialog({ defaultMessage: "Done", }) // Disable add room if booking code is either voucher or corporate cheque, or reward night is enabled - const addRoomDisabledTextForSpecialRate = getValues(REDEMPTION) + const addRoomDisabledTextForSpecialRate = getValues(SEARCH_TYPE_REDEMPTION) ? intl.formatMessage({ defaultMessage: "Multi-room booking is not available with reward night.", @@ -73,7 +73,7 @@ export default function GuestsRoomsPickerDialog({ if (updatedRooms.length === 1) { trigger("bookingCode.value") - trigger(REDEMPTION) + trigger(SEARCH_TYPE_REDEMPTION) } }, [roomsValue, trigger, setValue] diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx index ff2dab9c5..adb5f7447 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx @@ -13,7 +13,7 @@ import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReserva import { Button } from "@scandic-hotels/design-system/Button" import { Typography } from "@scandic-hotels/design-system/Typography" import { bedTypeMap } from "@scandic-hotels/trpc/constants/bedTypeMap" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { BookingStatusEnum } from "@scandic-hotels/trpc/enums/bookingStatus" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" @@ -517,7 +517,7 @@ export default function PaymentClient({ onSubmit={methods.handleSubmit(handleSubmit)} id={formId} > - {booking.searchType === REDEMPTION ? ( + {booking.searchType === SEARCH_TYPE_REDEMPTION ? ( ) : hasOnlyFlexRates && !bookingMustBeGuaranteed ? ( diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts index 97bc8ed01..b9f4b8444 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Tracking/tracking.ts @@ -1,7 +1,7 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum" import { PackageTypeEnum } from "@scandic-hotels/trpc/enums/packages" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" @@ -192,9 +192,9 @@ export function getTracking( }) ), ].join(","), - rewardNight: booking.searchType === REDEMPTION ? "yes" : "no", + rewardNight: booking.searchType === SEARCH_TYPE_REDEMPTION ? "yes" : "no", rewardNightAvailability: - booking.searchType === REDEMPTION ? "true" : "false", + booking.searchType === SEARCH_TYPE_REDEMPTION ? "true" : "false", roomPrice: calcTotalRoomPrice(storedRooms, isMember), roomTypeCode: rooms.map((room) => room.roomTypeCode).join("|"), roomTypeName: rooms.map((room) => room.roomType).join("|"), diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/index.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/index.tsx index 033a40dc0..afca35c9c 100644 --- a/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/index.tsx +++ b/apps/scandic-web/components/HotelReservation/SelectRate/Tracking/index.tsx @@ -3,7 +3,7 @@ import { useSearchParams } from "next/navigation" import React from "react" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import TrackingSDK from "@/components/TrackingSDK" import useLang from "@/hooks/useLang" @@ -57,7 +57,7 @@ export default function Tracking({ city, paramCity, bookingCode, - searchType === REDEMPTION, + searchType === SEARCH_TYPE_REDEMPTION, rooms ) diff --git a/apps/scandic-web/constants/booking.ts b/apps/scandic-web/constants/booking.ts index 22c382993..5a759351f 100644 --- a/apps/scandic-web/constants/booking.ts +++ b/apps/scandic-web/constants/booking.ts @@ -7,7 +7,7 @@ import BedSingleIcon from "@scandic-hotels/design-system/Icons/BedSingleIcon" import BedSofaExtraIcon from "@scandic-hotels/design-system/Icons/BedSofaExtraIcon" import BedTwinIcon from "@scandic-hotels/design-system/Icons/BedTwinIcon" import BedWallExtraIcon from "@scandic-hotels/design-system/Icons/BedWallExtraIcon" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod" import type { IconProps } from "@scandic-hotels/design-system/Icons" @@ -19,7 +19,7 @@ import type { JSX } from "react" export const FamilyAndFriendsCodes = ["D000029555", "D000029271", "D000029195"] -export const bookingSearchTypes = [REDEMPTION] as const +export const bookingSearchTypes = [SEARCH_TYPE_REDEMPTION] as const export const SEARCHTYPE = "searchtype" export const MEMBERSHIP_FAILED_ERROR = "MembershipFailedError" diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index 79b65c824..08deed6c9 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -1,8 +1,6 @@ import { createEnv } from "@t3-oss/env-nextjs" import { z } from "zod" -const TWENTYFOUR_HOURS = 24 * 60 * 60 - export const env = createEnv({ /** * Due to t3-env only checking typeof window === "undefined" @@ -21,14 +19,10 @@ export const env = createEnv({ // transform to boolean .transform((s) => s === "true") .default("false"), - API_BASEURL: z.string(), BUILD_ID: z.string().default("64rYXBu8o2eHp0Jf"), CMS_ACCESS_TOKEN: z.string(), CMS_API_KEY: z.string(), CMS_ENVIRONMENT: z.enum(["development", "production", "stage", "test"]), - CMS_PREVIEW_TOKEN: z.string(), - CMS_PREVIEW_URL: z.string(), - CMS_URL: z.string(), CMS_BRANCH: z.enum(["development", "production"]), CURITY_CLIENT_ID_USER: z.string().default("scandichotels-web"), CURITY_CLIENT_ID_SERVICE: z.string().default("scandichotels-web-backend"), @@ -49,15 +43,9 @@ export const env = createEnv({ NEXTAUTH_URL: z.string().default(""), AUTH_URL: z.string().default(""), NODE_ENV: z.enum(["development", "test", "production"]), - PRINT_QUERY: z - .string() - .refine((s) => s === "true" || s === "false") - .transform((s) => s === "true") - .default("false"), PUBLIC_URL: z.string().default(""), REVALIDATE_SECRET: z.string(), SITEMAP_SYNC_SECRET: z.string(), - SALESFORCE_PREFERENCE_BASE_URL: z.string(), SEAMLESS_LOGIN_DA: z .string() .transform((s) => replaceTopLevelDomain(s, "dk")), @@ -102,7 +90,6 @@ export const env = createEnv({ .transform((s) => s === "true") .default("false"), WEBVIEW_ENCRYPTION_KEY: z.string(), - BOOKING_ENCRYPTION_KEY: z.string(), GOOGLE_STATIC_MAP_KEY: z.string(), GOOGLE_STATIC_MAP_SIGNATURE_SECRET: z.string(), GOOGLE_DYNAMIC_MAP_ID: z.string(), @@ -139,9 +126,7 @@ export const env = createEnv({ SENTRY_SERVER_SAMPLERATE: z.coerce.number().default(0.001), // TODO: remove defaults for SAS value when we know that netlify has 'room' for it - SAS_API_ENDPOINT: z.string().default(""), SAS_AUTH_ENDPOINT: z.string().default(""), - SAS_OCP_APIM: z.string().default(""), SAS_AUTH_CLIENTID: z.string().default(""), SAS_POINT_TRANSFER_ENABLED: z .string() @@ -150,16 +135,6 @@ export const env = createEnv({ // transform to boolean .transform((s) => s === "true") .default("false"), - CACHE_TIME_HOTELS: z.coerce - .number() - .default(TWENTYFOUR_HOURS) - .transform((val) => - process.env.CMS_ENVIRONMENT === "test" ? 5 * 60 : val - ), - CACHE_TIME_CITY_SEARCH: z.coerce - .number() - .default(10 * 60) - .transform((val) => (process.env.CMS_ENVIRONMENT === "test" ? 60 : val)), REDIS_API_HOST: z.string().optional(), REDIS_API_KEY: z.string().optional(), BRANCH: @@ -195,14 +170,10 @@ export const env = createEnv({ ADOBE_SCRIPT_SRC: process.env.ADOBE_SCRIPT_SRC, ADOBE_SDK_SCRIPT_SRC: process.env.ADOBE_SDK_SCRIPT_SRC, ENABLE_GTMSCRIPT: process.env.ENABLE_GTMSCRIPT, - API_BASEURL: process.env.API_BASEURL, BUILD_ID: process.env.BUILD_ID, CMS_ACCESS_TOKEN: process.env.CMS_ACCESS_TOKEN, CMS_API_KEY: process.env.CMS_API_KEY, CMS_ENVIRONMENT: process.env.CMS_ENVIRONMENT, - CMS_PREVIEW_TOKEN: process.env.CMS_PREVIEW_TOKEN, - CMS_PREVIEW_URL: process.env.CMS_PREVIEW_URL, - CMS_URL: process.env.CMS_URL, CMS_BRANCH: process.env.CMS_BRANCH, CURITY_CLIENT_ID_USER: process.env.CURITY_CLIENT_ID_USER, CURITY_CLIENT_ID_SERVICE: process.env.CURITY_CLIENT_ID_SERVICE, @@ -218,11 +189,9 @@ export const env = createEnv({ NEXTAUTH_URL: process.env.NEXTAUTH_URL, AUTH_URL: process.env.AUTH_URL, NODE_ENV: process.env.NODE_ENV, - PRINT_QUERY: process.env.PRINT_QUERY, PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, REVALIDATE_SECRET: process.env.REVALIDATE_SECRET, SITEMAP_SYNC_SECRET: process.env.SITEMAP_SYNC_SECRET, - SALESFORCE_PREFERENCE_BASE_URL: process.env.SALESFORCE_PREFERENCE_BASE_URL, SEAMLESS_LOGIN_DA: process.env.SEAMLESS_LOGIN || process.env.SEAMLESS_LOGIN_DA, SEAMLESS_LOGIN_DE: @@ -249,7 +218,6 @@ export const env = createEnv({ process.env.SEAMLESS_LOGOUT || process.env.SEAMLESS_LOGOUT_SV, SHOW_SIGNUP_FLOW: process.env.SHOW_SIGNUP_FLOW, WEBVIEW_ENCRYPTION_KEY: process.env.WEBVIEW_ENCRYPTION_KEY, - BOOKING_ENCRYPTION_KEY: process.env.BOOKING_ENCRYPTION_KEY, GOOGLE_STATIC_MAP_KEY: process.env.GOOGLE_STATIC_MAP_KEY, GOOGLE_STATIC_MAP_SIGNATURE_SECRET: process.env.GOOGLE_STATIC_MAP_SIGNATURE_SECRET, @@ -262,15 +230,10 @@ export const env = createEnv({ SENTRY_ENVIRONMENT: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT, SENTRY_SERVER_SAMPLERATE: process.env.SENTRY_SERVER_SAMPLERATE, - SAS_API_ENDPOINT: process.env.SAS_API_ENDPOINT, 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_POINT_TRANSFER_ENABLED: process.env.SAS_POINT_TRANSFER_ENABLED, - CACHE_TIME_HOTELS: process.env.CACHE_TIME_HOTELS, - CACHE_TIME_CITY_SEARCH: process.env.CACHE_TIME_CITY_SEARCH, - REDIS_API_HOST: process.env.REDIS_API_HOST, REDIS_API_KEY: process.env.REDIS_API_KEY, BRANCH: process.env.BRANCH, diff --git a/apps/scandic-web/middlewares/bookingFlow.ts b/apps/scandic-web/middlewares/bookingFlow.ts index bd42abaff..f35f52230 100644 --- a/apps/scandic-web/middlewares/bookingFlow.ts +++ b/apps/scandic-web/middlewares/bookingFlow.ts @@ -1,7 +1,7 @@ import { type NextMiddleware, NextResponse } from "next/server" import { findLang } from "@scandic-hotels/common/utils/languages" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { isValidSession } from "@scandic-hotels/trpc/utils/session" import { SEARCHTYPE } from "@/constants/booking" @@ -17,7 +17,7 @@ import type { MiddlewareMatcher } from "@/types/middleware" export const middleware: NextMiddleware = async (request) => { // Redirect user to login if reward nights search and not logged in const isRedemption = - request.nextUrl.searchParams.get(SEARCHTYPE) === REDEMPTION + request.nextUrl.searchParams.get(SEARCHTYPE) === SEARCH_TYPE_REDEMPTION const session = await auth() // Check for user session if (isRedemption && !isValidSession(session)) { const lang = findLang(request.nextUrl.pathname)! diff --git a/apps/scandic-web/package.json b/apps/scandic-web/package.json index f8f9f9cf6..ee642e92f 100644 --- a/apps/scandic-web/package.json +++ b/apps/scandic-web/package.json @@ -76,11 +76,7 @@ "embla-carousel": "^8.6.0", "embla-carousel-react": "^8.6.0", "fast-deep-equal": "^3.1.3", - "fetch-retry": "^6.0.0", "flat": "^6.0.1", - "fuse.js": "^7.1.0", - "graphql": "^16.11.0", - "graphql-request": "^7.1.2", "graphql-tag": "^2.12.6", "html-react-parser": "^5.2.3", "ics": "^3.8.1", @@ -106,11 +102,9 @@ "react-intl": "^7.1.11", "react-to-print": "^3.1.0", "server-only": "^0.0.1", - "slugify": "^1.6.6", "sonner": "^2.0.3", "supercluster": "^8.0.1", "usehooks-ts": "3.1.1", - "uuid": "^11.1.0", "zod": "^3.24.4", "zustand": "^4.5.2" }, diff --git a/apps/scandic-web/stores/select-rate/index.ts b/apps/scandic-web/stores/select-rate/index.ts index fa31a6f2a..38f4a7d92 100644 --- a/apps/scandic-web/stores/select-rate/index.ts +++ b/apps/scandic-web/stores/select-rate/index.ts @@ -2,7 +2,7 @@ import { produce } from "immer" import { useContext } from "react" import { create, useStore } from "zustand" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" @@ -120,7 +120,7 @@ export function createRatesStore({ activeRoom = unselectedRoomIndex } - const isRedemptionBooking = booking.searchType === REDEMPTION + const isRedemptionBooking = booking.searchType === SEARCH_TYPE_REDEMPTION const defaultCurrency = findDefaultCurrency(roomsAvailability) diff --git a/apps/scandic-web/utils/hotelSearchDetails.ts b/apps/scandic-web/utils/hotelSearchDetails.ts index 66b07df88..b912aa7ce 100644 --- a/apps/scandic-web/utils/hotelSearchDetails.ts +++ b/apps/scandic-web/utils/hotelSearchDetails.ts @@ -1,7 +1,7 @@ import { notFound } from "next/navigation" import { safeTry } from "@scandic-hotels/common/utils/safeTry" -import { REDEMPTION } from "@scandic-hotels/trpc/constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "@scandic-hotels/trpc/constants/booking" import { generateChildrenString } from "@scandic-hotels/trpc/routers/hotels/helpers" import { type HotelLocation, @@ -101,6 +101,6 @@ export async function getHotelSearchDetails( cityIdentifier, hotel, noOfRooms: rooms?.length ?? 0, - redemption: params.searchType === REDEMPTION, + redemption: params.searchType === SEARCH_TYPE_REDEMPTION, } } diff --git a/packages/trpc/auth.d.ts b/packages/trpc/auth.d.ts index 66e129e96..e61f81704 100644 --- a/packages/trpc/auth.d.ts +++ b/packages/trpc/auth.d.ts @@ -1,4 +1,3 @@ -// TODO might just want to duplicate this file in each package that needs it import type { JWT } from "next-auth/jwt" import type { RefreshTokenError } from "./lib/types/authError" diff --git a/packages/trpc/env/server.ts b/packages/trpc/env/server.ts index 36b752b2f..3cc5aef23 100644 --- a/packages/trpc/env/server.ts +++ b/packages/trpc/env/server.ts @@ -1,17 +1,9 @@ import { createEnv } from "@t3-oss/env-nextjs" import { z } from "zod" -import { isLangLive } from "../lib/DUPLICATED/isLangLive" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -/* - * ⚠️ Remember to also add environment variables to the corresponding config in sites that uses this package. ⚠️ - */ - 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" @@ -48,17 +40,6 @@ const _env = createEnv({ .refine((s) => s === "true" || s === "false") .transform((s) => s === "true") .default("false"), - /** - * 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(""), SALESFORCE_PREFERENCE_BASE_URL: z.string(), }, emptyStringAsUndefined: true, @@ -80,12 +61,6 @@ const _env = createEnv({ SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT, PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL, PRINT_QUERY: process.env.PRINT_QUERY, - NEW_SITE_LIVE_FOR_LANGS: process.env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS, SALESFORCE_PREFERENCE_BASE_URL: process.env.SALESFORCE_PREFERENCE_BASE_URL, }, }) - -export const env = { - ..._env, - isLangLive: (lang: Lang) => isLangLive(lang, _env.NEW_SITE_LIVE_FOR_LANGS), -} as const diff --git a/packages/trpc/jwt.d.ts b/packages/trpc/jwt.d.ts index ddb9bfc3a..a78f6c021 100644 --- a/packages/trpc/jwt.d.ts +++ b/packages/trpc/jwt.d.ts @@ -1,4 +1,3 @@ -// TODO might just want to duplicate this file in each package that needs it import type { DefaultJWT } from "next-auth/jwt" import type { RefreshTokenError } from "./lib/types/authError" diff --git a/packages/trpc/lib/DUPLICATED/isLangLive.test.ts b/packages/trpc/lib/DUPLICATED/isLangLive.test.ts deleted file mode 100644 index d25127b85..000000000 --- a/packages/trpc/lib/DUPLICATED/isLangLive.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { describe, expect, it } from "vitest" - -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/packages/trpc/lib/DUPLICATED/isLangLive.ts b/packages/trpc/lib/DUPLICATED/isLangLive.ts deleted file mode 100644 index 2a985f3fa..000000000 --- a/packages/trpc/lib/DUPLICATED/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/packages/trpc/lib/constants/booking.ts b/packages/trpc/lib/constants/booking.ts index 01ca41429..09ca52c97 100644 --- a/packages/trpc/lib/constants/booking.ts +++ b/packages/trpc/lib/constants/booking.ts @@ -1,2 +1 @@ -// TODO better name? -export const REDEMPTION = "redemption" +export const SEARCH_TYPE_REDEMPTION = "redemption" diff --git a/packages/trpc/lib/routers/autocomplete/util/getSearchTokens.test.ts b/packages/trpc/lib/routers/autocomplete/util/getSearchTokens.test.ts index 49bc4163b..1302b7eba 100644 --- a/packages/trpc/lib/routers/autocomplete/util/getSearchTokens.test.ts +++ b/packages/trpc/lib/routers/autocomplete/util/getSearchTokens.test.ts @@ -2,9 +2,8 @@ import { describe, expect, it } from "vitest" import { getSearchTokens } from "./getSearchTokens" -import type { Location } from "@scandic-hotels/trpc/types/locations" - import type { DeepPartial } from "../../../types/deepPartial" +import type { Location } from "../../../types/locations" describe("getSearchTokens", () => { it("should return lowercased tokens for a hotel location", () => { diff --git a/packages/trpc/lib/routers/contentstack/accountPage/query.ts b/packages/trpc/lib/routers/contentstack/accountPage/query.ts index 644414ca1..0249ad1a1 100644 --- a/packages/trpc/lib/routers/contentstack/accountPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/query.ts @@ -1,13 +1,13 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetAccountPage, GetAccountPageRefs, } from "../../../graphql/Query/AccountPage/AccountPage.graphql" import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { generateRefsResponseTag, generateTag, diff --git a/packages/trpc/lib/routers/contentstack/base/query.ts b/packages/trpc/lib/routers/contentstack/base/query.ts index 638d366d7..169445366 100644 --- a/packages/trpc/lib/routers/contentstack/base/query.ts +++ b/packages/trpc/lib/routers/contentstack/base/query.ts @@ -1,10 +1,9 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetContactConfig } from "../../../graphql/Query/ContactConfig.graphql" import { GetCurrentFooter, @@ -22,6 +21,7 @@ import { } from "../../../graphql/Query/SiteConfig.graphql" // import { router } from "../../.." import { request } from "../../../graphql/request" +import { contentstackBaseProcedure } from "../../../procedures" import { langInput } from "../../../utils" import { generateRefsResponseTag, diff --git a/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts index ba0cc3178..72ed4c7ec 100644 --- a/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts @@ -1,11 +1,10 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." import { PageContentTypeEnum } from "../../../enums/contentType" +import { notFound } from "../../../errors" import { GetMyPagesBreadcrumbs, GetMyPagesBreadcrumbsRefs, @@ -47,6 +46,7 @@ import { GetLoyaltyPageBreadcrumbsRefs, } from "../../../graphql/Query/Breadcrumbs/LoyaltyPage.graphql" import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { generateRefsResponseTag } from "../../../utils/generateTag" import { breadcrumbsRefsSchema, breadcrumbsSchema } from "./output" import { getTags } from "./utils" diff --git a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts index 6a1c6aab7..2d339f9aa 100644 --- a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts @@ -1,14 +1,14 @@ 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 { router } from "../../.." +import { notFound } from "../../../errors" import { GetCampaignOverviewPage, GetCampaignOverviewPageRefs, } from "../../../graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" +import { request } from "../../../graphql/request" +import { contentStackUidWithServiceProcedure } from "../../../procedures" +import { generateRefsResponseTag } from "../../../utils/generateTag" import { campaignOverviewPageRefsSchema, campaignOverviewPageSchema, diff --git a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts index 1098bda21..d468f7143 100644 --- a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts @@ -1,13 +1,10 @@ -import { - generateTag, - generateTagsFromSystem, -} from "@scandic-hotels/trpc/utils/generateTag" +import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" import { CampaignOverviewPageEnum } from "../../../types/campaignOverviewPageEnum" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { System } from "@scandic-hotels/trpc/routers/contentstack/schemas/system" +import type { System } from "../../../routers/contentstack/schemas/system" import type { CampaignOverviewPageRefs } from "../../../types/campaignOverviewPage" export function generatePageTags( diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts index f1a196c0d..ec2cc6c79 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts @@ -1,13 +1,13 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetCampaignPage, GetCampaignPageRefs, } from "../../../graphql/Query/CampaignPage/CampaignPage.graphql" import { request } from "../../../graphql/request" +import { contentStackUidWithServiceProcedure } from "../../../procedures" import { generateRefsResponseTag } from "../../../utils/generateTag" import { campaignPageRefsSchema, campaignPageSchema } from "./output" import { generatePageTags } from "./utils" diff --git a/packages/trpc/lib/routers/contentstack/collectionPage/query.ts b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts index febc347c4..4c957c23d 100644 --- a/packages/trpc/lib/routers/contentstack/collectionPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts @@ -1,9 +1,9 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." import { GetCollectionPage } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { collectionPageSchema } from "./output" import { fetchCollectionPageRefs, diff --git a/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts b/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts index 5295effc3..a206c8153 100644 --- a/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts @@ -1,6 +1,6 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" +import { notFound } from "../../../errors" import { GetCollectionPageRefs } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" import { request } from "../../../graphql/request" import { diff --git a/packages/trpc/lib/routers/contentstack/contentPage/query.ts b/packages/trpc/lib/routers/contentstack/contentPage/query.ts index 904d3335f..a88419261 100644 --- a/packages/trpc/lib/routers/contentstack/contentPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/query.ts @@ -1,5 +1,4 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." import { batchRequest } from "../../../graphql/batchRequest" @@ -8,6 +7,7 @@ import { GetContentPageBlocksBatch1, GetContentPageBlocksBatch2, } from "../../../graphql/Query/ContentPage/ContentPage.graphql" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { contentPageSchema } from "./output" import { fetchContentPageRefs, generatePageTags } from "./utils" diff --git a/packages/trpc/lib/routers/contentstack/contentPage/utils.ts b/packages/trpc/lib/routers/contentstack/contentPage/utils.ts index 0a82f3a0a..4960ad0c2 100644 --- a/packages/trpc/lib/routers/contentstack/contentPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/utils.ts @@ -1,6 +1,6 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" +import { notFound } from "../../../errors" import { batchRequest } from "../../../graphql/batchRequest" import { GetContentPageBlocksRefs, diff --git a/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts index cf011c8a6..edb904d65 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts @@ -1,13 +1,13 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetDestinationCityPage, GetDestinationCityPageRefs, } from "../../../graphql/Query/DestinationCityPage/DestinationCityPage.graphql" import { request } from "../../../graphql/request" +import { contentStackUidWithServiceProcedure } from "../../../procedures" import { generateRefsResponseTag } from "../../../utils/generateTag" import { getCityByCityIdentifier } from "../../hotels/utils" import { diff --git a/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts index 00e86d59e..e65bedfcc 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts @@ -1,16 +1,16 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { - contentStackBaseWithServiceProcedure, - contentstackExtendedProcedureUID, -} from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetDestinationCountryPage, GetDestinationCountryPageRefs, } from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" import { request } from "../../../graphql/request" +import { + contentStackBaseWithServiceProcedure, + contentstackExtendedProcedureUID, +} from "../../../procedures" import { ApiCountry } from "../../../types/country" import { generateRefsResponseTag } from "../../../utils/generateTag" import { getCityPagesInput } from "./input" diff --git a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts index e58978621..57f59c3f4 100644 --- a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts @@ -1,18 +1,18 @@ import { Lang } from "@scandic-hotels/common/constants/language" import { createCounter } from "@scandic-hotels/common/telemetry" import { safeTry } from "@scandic-hotels/common/utils/safeTry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { - contentstackExtendedProcedureUID, - serviceProcedure, -} from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetDestinationOverviewPage, GetDestinationOverviewPageRefs, } from "../../../graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" import { request } from "../../../graphql/request" +import { + contentstackExtendedProcedureUID, + serviceProcedure, +} from "../../../procedures" import { ApiCountry, type Country } from "../../../types/country" import { generateRefsResponseTag, diff --git a/packages/trpc/lib/routers/contentstack/hotelPage/query.ts b/packages/trpc/lib/routers/contentstack/hotelPage/query.ts index 95467b17c..c22140848 100644 --- a/packages/trpc/lib/routers/contentstack/hotelPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/query.ts @@ -1,10 +1,10 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetHotelPage } from "../../../graphql/Query/HotelPage/HotelPage.graphql" import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { generateTag } from "../../../utils/generateTag" import { hotelPageSchema } from "./output" diff --git a/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts index c3cf9169f..36748d286 100644 --- a/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts +++ b/packages/trpc/lib/routers/contentstack/languageSwitcher/query.ts @@ -1,6 +1,5 @@ -import { publicProcedure } from "@scandic-hotels/trpc/procedures" - import { router } from "../../.." +import { publicProcedure } from "../../../procedures" import { getUidAndContentTypeByPath } from "../../../services/cms/getUidAndContentTypeByPath" import { getNonContentstackUrls } from "../metadata/output" import { getLanguageSwitcherInput } from "./input" diff --git a/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts b/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts index 8b9879a82..9764dc95f 100644 --- a/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts +++ b/packages/trpc/lib/routers/contentstack/languageSwitcher/utils.ts @@ -1,9 +1,9 @@ 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 { PageContentTypeEnum } from "../../../enums/contentType" +import { internalServerError } from "../../../errors" import { batchRequest } from "../../../graphql/batchRequest" import { GetDaDeEnUrlsAccountPage, diff --git a/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts index aea8bde4a..b0edb0feb 100644 --- a/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts @@ -1,13 +1,13 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetLoyaltyPage, GetLoyaltyPageRefs, } from "../../../graphql/Query/LoyaltyPage/LoyaltyPage.graphql" import { request } from "../../../graphql/request" +import { contentstackExtendedProcedureUID } from "../../../procedures" import { generateRefsResponseTag, generateTag, diff --git a/packages/trpc/lib/routers/contentstack/metadata/query.ts b/packages/trpc/lib/routers/contentstack/metadata/query.ts index 3d353a31b..e4047f3fe 100644 --- a/packages/trpc/lib/routers/contentstack/metadata/query.ts +++ b/packages/trpc/lib/routers/contentstack/metadata/query.ts @@ -1,11 +1,10 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." import { PageContentTypeEnum } from "../../../enums/contentType" +import { notFound } from "../../../errors" import { GetAccountPageMetadata } from "../../../graphql/Query/AccountPage/Metadata.graphql" import { GetCampaignOverviewPageMetadata } from "../../../graphql/Query/CampaignOverviewPage/Metadata.graphql" import { GetCampaignPageMetadata } from "../../../graphql/Query/CampaignPage/Metadata.graphql" @@ -18,6 +17,7 @@ import { GetHotelPageMetadata } from "../../../graphql/Query/HotelPage/Metadata. import { GetLoyaltyPageMetadata } from "../../../graphql/Query/LoyaltyPage/Metadata.graphql" import { GetStartPageMetadata } from "../../../graphql/Query/StartPage/Metadata.graphql" import { request } from "../../../graphql/request" +import { contentStackUidWithServiceProcedure } from "../../../procedures" import { generateTag } from "../../../utils/generateTag" import { getHotel } from "../../hotels/utils" import { getUrlsOfAllLanguages } from "../languageSwitcher/utils" diff --git a/packages/trpc/lib/routers/contentstack/pageSettings/query.ts b/packages/trpc/lib/routers/contentstack/pageSettings/query.ts index 06e4b9a6e..13a04ce15 100644 --- a/packages/trpc/lib/routers/contentstack/pageSettings/query.ts +++ b/packages/trpc/lib/routers/contentstack/pageSettings/query.ts @@ -1,7 +1,5 @@ import * as Sentry from "@sentry/nextjs" -import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" - import { router } from "../../.." import { PageContentTypeEnum } from "../../../enums/contentType" import { @@ -19,6 +17,7 @@ import { GetStartPageSettings, } from "../../../graphql/Query/PageSettings.graphql" import { request } from "../../../graphql/request" +import { contentstackBaseProcedure } from "../../../procedures" import { langInput } from "../../../utils" import { generateTag } from "../../../utils/generateTag" import { diff --git a/packages/trpc/lib/routers/contentstack/partner/query.ts b/packages/trpc/lib/routers/contentstack/partner/query.ts index 980bb8ca8..eaa089564 100644 --- a/packages/trpc/lib/routers/contentstack/partner/query.ts +++ b/packages/trpc/lib/routers/contentstack/partner/query.ts @@ -1,12 +1,12 @@ import { cache } from "react" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFound } from "@scandic-hotels/trpc/errors" -import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures" import { router } from "../../.." +import { notFound } from "../../../errors" import { GetAllSasTierComparison } from "../../../graphql/Query/SASTierComparison.graphql" import { request } from "../../../graphql/request" +import { contentstackBaseProcedure } from "../../../procedures" import { validateSasTierComparisonSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" diff --git a/packages/trpc/lib/routers/hotels/query.ts b/packages/trpc/lib/routers/hotels/query.ts index 0cd0ba641..c01be1b22 100644 --- a/packages/trpc/lib/routers/hotels/query.ts +++ b/packages/trpc/lib/routers/hotels/query.ts @@ -6,7 +6,7 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { env } from "../../../env/server" import { router } from "../.." import * as api from "../../api" -import { REDEMPTION } from "../../constants/booking" +import { SEARCH_TYPE_REDEMPTION } from "../../constants/booking" import { BreakfastPackageEnum } from "../../enums/breakfast" import { RateEnum } from "../../enums/rate" import { RateTypeEnum } from "../../enums/rateType" @@ -149,7 +149,7 @@ export const hotelQueryRouter = router({ enterDetails: safeProtectedServiceProcedure .input(enterDetailsRoomsAvailabilityInputSchema) .use(async ({ ctx, input, next }) => { - if (input.booking.searchType === REDEMPTION) { + if (input.booking.searchType === SEARCH_TYPE_REDEMPTION) { if (ctx.session?.token.access_token) { const verifiedUser = await getVerifiedUser({ session: ctx.session }) if (!verifiedUser?.error) { @@ -299,7 +299,7 @@ export const hotelQueryRouter = router({ myStay: safeProtectedServiceProcedure .input(myStayRoomAvailabilityInputSchema) .use(async ({ ctx, input, next }) => { - if (input.booking.searchType === REDEMPTION) { + if (input.booking.searchType === SEARCH_TYPE_REDEMPTION) { if (ctx.session?.token.access_token) { const verifiedUser = await getVerifiedUser({ session: ctx.session }) if (!verifiedUser?.error) { @@ -360,7 +360,7 @@ export const hotelQueryRouter = router({ room: safeProtectedServiceProcedure .input(selectRateRoomAvailabilityInputSchema) .use(async ({ ctx, input, next }) => { - if (input.booking.searchType === REDEMPTION) { + if (input.booking.searchType === SEARCH_TYPE_REDEMPTION) { if (ctx.session?.token.access_token) { const verifiedUser = await getVerifiedUser({ session: ctx.session, @@ -414,7 +414,7 @@ export const hotelQueryRouter = router({ rooms: safeProtectedServiceProcedure .input(selectRateRoomsAvailabilityInputSchema) .use(async ({ ctx, input, next }) => { - if (input.booking.searchType === REDEMPTION) { + if (input.booking.searchType === SEARCH_TYPE_REDEMPTION) { if (ctx.session?.token.access_token) { const verifiedUser = await getVerifiedUser({ session: ctx.session, diff --git a/packages/trpc/lib/routers/hotels/schemas/meetingRoom.ts b/packages/trpc/lib/routers/hotels/schemas/meetingRoom.ts index 01085a5c6..8e6933fc8 100644 --- a/packages/trpc/lib/routers/hotels/schemas/meetingRoom.ts +++ b/packages/trpc/lib/routers/hotels/schemas/meetingRoom.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { imageSchema } from "@scandic-hotels/trpc/routers/hotels/schemas/image" +import { imageSchema } from "../../../routers/hotels/schemas/image" export const meetingRoomsSchema = z.object({ data: z.array( diff --git a/packages/trpc/lib/routers/hotels/utils.ts b/packages/trpc/lib/routers/hotels/utils.ts index 677044aad..70c61d22c 100644 --- a/packages/trpc/lib/routers/hotels/utils.ts +++ b/packages/trpc/lib/routers/hotels/utils.ts @@ -6,25 +6,25 @@ import { selectRate } from "@scandic-hotels/common/constants/routes/hotelReserva import { getCacheClient } from "@scandic-hotels/common/dataCache" import { createCounter } from "@scandic-hotels/common/telemetry" import { chunk } from "@scandic-hotels/common/utils/chunk" -import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter" -import { AvailabilityEnum } from "@scandic-hotels/trpc/enums/selectHotel" -import { type RoomFeaturesInput } from "@scandic-hotels/trpc/routers/hotels/input" + +import { env } from "../../../env/server" +import * as api from "../../api" +import { SEARCH_TYPE_REDEMPTION } from "../../constants/booking" +import { cache } from "../../DUPLICATED/cache" +import { BookingErrorCodeEnum } from "../../enums/bookingErrorCode" +import { HotelTypeEnum } from "../../enums/hotelType" +import { RoomPackageCodeEnum } from "../../enums/roomFilter" +import { AvailabilityEnum } from "../../enums/selectHotel" +import { badRequestError } from "../../errors" +import { type RoomFeaturesInput } from "../../routers/hotels/input" import { hotelsAvailabilitySchema, packagesSchema, roomFeaturesSchema, roomsAvailabilitySchema, -} from "@scandic-hotels/trpc/routers/hotels/output" -import { sortRoomConfigs } from "@scandic-hotels/trpc/utils/sortRoomConfigs" - -import { env } from "../../../env/server" -import * as api from "../../api" -import { REDEMPTION } from "../../constants/booking" -import { cache } from "../../DUPLICATED/cache" -import { BookingErrorCodeEnum } from "../../enums/bookingErrorCode" -import { HotelTypeEnum } from "../../enums/hotelType" -import { badRequestError } from "../../errors" +} from "../../routers/hotels/output" import { toApiLang } from "../../utils" +import { sortRoomConfigs } from "../../utils/sortRoomConfigs" import { getHotelPageUrls } from "../contentstack/hotelPage/utils" import { generateChildrenString } from "./helpers" import { @@ -36,14 +36,6 @@ import { locationsSchema, } from "./output" -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 { z } from "zod" import type { Endpoint } from "../../api/endpoints" @@ -55,12 +47,20 @@ import type { RoomsAvailabilityOutputSchema, } from "../../types/availability" import type { BedTypeSelection } from "../../types/bedTypeSelection" +import type { Room as RoomCategory } from "../../types/hotel" import type { DestinationPagesHotelData, HotelInput } from "../../types/hotel" import type { CitiesGroupedByCountry, CityLocation, } from "../../types/locations" import type { PackagesOutput } from "../../types/packages" +import type { + Product, + Products, + RateDefinition, + RedemptionsProduct, + RoomConfiguration, +} from "../../types/roomAvailability" import type { Cities } from "./output" export const locationsAffix = "locations" @@ -981,7 +981,7 @@ export async function getRoomsAvailability( lang, } = input - const redemption = searchType === REDEMPTION + const redemption = searchType === SEARCH_TYPE_REDEMPTION const getRoomsAvailabilityCounter = createCounter( "hotel", diff --git a/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts b/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts index 3e13c526a..2a8d9b486 100644 --- a/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts +++ b/packages/trpc/lib/routers/navigation/mypages/getPrimaryLinks.ts @@ -6,8 +6,8 @@ import { safeTry } from "@scandic-hotels/common/utils/safeTry" import { getEurobonusMembership } from "../../user/helpers" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { UserLoyalty } from "@scandic-hotels/trpc/types/user" +import type { UserLoyalty } from "../../../types/user" import type { MyPagesLink } from "./MyPagesLink" export const getPrimaryLinks = cache( diff --git a/packages/trpc/lib/routers/user/index.ts b/packages/trpc/lib/routers/user/index.ts index 759c466ae..6b1198d2e 100644 --- a/packages/trpc/lib/routers/user/index.ts +++ b/packages/trpc/lib/routers/user/index.ts @@ -1,5 +1,4 @@ -import { mergeRouters } from "@scandic-hotels/trpc" - +import { mergeRouters } from "../.." import { userMutationRouter } from "./mutation" import { userQueryRouter } from "./query" diff --git a/packages/trpc/lib/routers/user/query.ts b/packages/trpc/lib/routers/user/query.ts index 024939b0b..efba14f76 100644 --- a/packages/trpc/lib/routers/user/query.ts +++ b/packages/trpc/lib/routers/user/query.ts @@ -1,20 +1,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" -import { router } from "@scandic-hotels/trpc" -import * as api from "@scandic-hotels/trpc/api" + +import { router } from "../.." +import * as api from "../../api" +import { Transactions } from "../../enums/transactions" import { languageProtectedProcedure, protectedProcedure, safeProtectedProcedure, -} from "@scandic-hotels/trpc/procedures" +} from "../../procedures" import { getFriendsMembership, getMembershipCards, -} from "@scandic-hotels/trpc/routers/user/helpers" -import { getVerifiedUser } from "@scandic-hotels/trpc/routers/user/utils" -import { toApiLang } from "@scandic-hotels/trpc/utils" -import { isValidSession } from "@scandic-hotels/trpc/utils/session" - -import { Transactions } from "../../enums/transactions" +} from "../../routers/user/helpers" +import { getVerifiedUser } from "../../routers/user/utils" +import { toApiLang } from "../../utils" +import { isValidSession } from "../../utils/session" import { friendTransactionsInput, getSavedPaymentCardsInput, @@ -30,8 +30,7 @@ import { updateStaysBookingUrl, } from "./utils" -import type { LoginType } from "@scandic-hotels/trpc/types/loginType" - +import type { LoginType } from "../../types/loginType" import type { TrackingUserData } from "../types" export const userQueryRouter = router({ diff --git a/packages/trpc/package.json b/packages/trpc/package.json index 7296b3c81..d59f053c0 100644 --- a/packages/trpc/package.json +++ b/packages/trpc/package.json @@ -36,9 +36,9 @@ "./utils/*": "./lib/utils/*.ts", "./cms/*": "./lib/services/cms/*.ts", "./previewContext": "./lib/previewContext.ts", - "./FIX-BELOW": "./unused", "./jwt.d.ts": "./jwt.d.ts", "./auth.d.ts": "./auth.d.ts", + "./TODO-REMOVE-BELOW": "./remove-when-current-web-is-gone", "./graphql/Query/Current/CurrentBlockPage.graphql": "./lib/graphql/Query/Current/CurrentBlockPage.graphql", "./graphql/Query/Current/CurrentBlockPageTrackingData.graphql": "./lib/graphql/Query/Current/CurrentBlockPageTrackingData.graphql" }, @@ -53,11 +53,13 @@ "fuse.js": "^7.1.0", "graphql": "^16.11.0", "graphql-request": "^7.1.2", + "graphql-tag": "^2.12.6", "json-stable-stringify-without-jsonify": "^1.0.1", "next-auth": "5.0.0-beta.27", "server-only": "^0.0.1", "slugify": "^1.6.6", "superjson": "^2.2.2", + "uuid": "^11.1.0", "zod": "^3.24.4" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 3adc4a730..f8de4c37f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7027,6 +7027,7 @@ __metadata: eslint-plugin-formatjs: "npm:^5.3.1" eslint-plugin-import: "npm:^2.31.0" eslint-plugin-simple-import-sort: "npm:^12.1.1" + graphql-tag: "npm:^2.12.6" next: "npm:15.3.4" react: "npm:^19.0.0" react-dom: "npm:^19.0.0" @@ -7149,11 +7150,7 @@ __metadata: eslint-plugin-import: "npm:^2.31.0" eslint-plugin-simple-import-sort: "npm:^12.1.1" fast-deep-equal: "npm:^3.1.3" - fetch-retry: "npm:^6.0.0" flat: "npm:^6.0.1" - fuse.js: "npm:^7.1.0" - graphql: "npm:^16.11.0" - graphql-request: "npm:^7.1.2" graphql-tag: "npm:^2.12.6" html-react-parser: "npm:^5.2.3" ics: "npm:^3.8.1" @@ -7186,7 +7183,6 @@ __metadata: react-to-print: "npm:^3.1.0" schema-dts: "npm:^1.1.5" server-only: "npm:^0.0.1" - slugify: "npm:^1.6.6" sonner: "npm:^2.0.3" start-server-and-test: "npm:^2.0.11" supercluster: "npm:^8.0.1" @@ -7195,7 +7191,6 @@ __metadata: typescript: "npm:5.8.3" typescript-plugin-css-modules: "npm:^5.1.0" usehooks-ts: "npm:3.1.1" - uuid: "npm:^11.1.0" vite-tsconfig-paths: "npm:^5.1.4" vitest: "npm:^3.2.4" zod: "npm:^3.24.4" @@ -7229,12 +7224,14 @@ __metadata: fuse.js: "npm:^7.1.0" graphql: "npm:^16.11.0" graphql-request: "npm:^7.1.2" + graphql-tag: "npm:^2.12.6" json-stable-stringify-without-jsonify: "npm:^1.0.1" next-auth: "npm:5.0.0-beta.27" server-only: "npm:^0.0.1" slugify: "npm:^1.6.6" superjson: "npm:^2.2.2" typescript: "npm:5.8.3" + uuid: "npm:^11.1.0" vitest: "npm:^3.2.3" zod: "npm:^3.24.4" peerDependencies: