Merged in chore/cleanup-after-trpc-migration (pull request #2457)
Chore/cleanup after trpc migration * Clean up TODOs * Rename REDEMPTION constant to SEARCH_TYPE_REDEMPTION * Update dependencies Remove unused deps from scandic-web Add missing deps to trpc package * Update self-referencing imports * Remove unused variables from scandic-web env * Fix missing graphql-tag package * Actually fix * Remove unused env var Approved-by: Christian Andolf Approved-by: Linus Flood
This commit is contained in:
1
packages/trpc/auth.d.ts
vendored
1
packages/trpc/auth.d.ts
vendored
@@ -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"
|
||||
|
||||
27
packages/trpc/env/server.ts
vendored
27
packages/trpc/env/server.ts
vendored
@@ -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
|
||||
|
||||
1
packages/trpc/jwt.d.ts
vendored
1
packages/trpc/jwt.d.ts
vendored
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
// TODO better name?
|
||||
export const REDEMPTION = "redemption"
|
||||
export const SEARCH_TYPE_REDEMPTION = "redemption"
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { mergeRouters } from "../.."
|
||||
import { userMutationRouter } from "./mutation"
|
||||
import { userQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user