Merged in feat/sw-2859-set-up-shared-trpc-package (pull request #2319)
feat(SW-2859): Create trpc package * Add isEdge, safeTry and dataCache to new common package * Add eslint and move prettier config * Clean up tests * Create trpc package and move initialization * Move errors and a few procedures * Move telemetry to common package * Move tokenManager to common package * Add Sentry to procedures * Clean up procedures * Fix self-referencing imports * Add exports to packages and lint rule to prevent relative imports * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * Fix lang imports Approved-by: Linus Flood
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
|
||||
import { safeProtectedServiceProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { safeProtectedServiceProcedure } from "@/server/trpc"
|
||||
import { isDefined } from "@/server/utils"
|
||||
|
||||
import { getCityPageUrls } from "../contentstack/destinationCityPage/utils"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
|
||||
import { getDestinationsAutoCompleteRoute } from "./destinations"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { bookingMutationRouter } from "./mutation"
|
||||
import { bookingQueryRouter } from "./query"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { ChildBedTypeEnum } from "@/constants/booking"
|
||||
import { Lang, langToApiLang } from "@/constants/languages"
|
||||
import { langToApiLang } from "@/constants/languages"
|
||||
|
||||
const roomsSchema = z
|
||||
.array(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { safeProtectedServiceProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { createRefIdPlugin } from "@/server/plugins/refIdToConfirmationNumber"
|
||||
import { getMembershipNumber } from "@/server/routers/user/utils"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { router, safeProtectedServiceProcedure } from "@/server/trpc"
|
||||
|
||||
import { encrypt } from "@/utils/encryption"
|
||||
import { isValidSession } from "@/utils/session"
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import * as api from "@/lib/api"
|
||||
import { badRequestError, serverErrorByStatus } from "@/server/errors/trpc"
|
||||
import { createRefIdPlugin } from "@/server/plugins/refIdToConfirmationNumber"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import {
|
||||
badRequestError,
|
||||
serverErrorByStatus,
|
||||
} from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
router,
|
||||
safeProtectedServiceProcedure,
|
||||
serviceProcedure,
|
||||
} from "@/server/trpc"
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { createRefIdPlugin } from "@/server/plugins/refIdToConfirmationNumber"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { getBookedHotelRoom } from "@/utils/booking"
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import {
|
||||
badRequestError,
|
||||
serverErrorByStatus,
|
||||
} from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { badRequestError, serverErrorByStatus } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { bookingConfirmationSchema, createBookingSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export async function getBooking(
|
||||
confirmationNumber: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { accountPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetAccountPage,
|
||||
GetAccountPageRefs,
|
||||
} from "@/lib/graphql/Query/AccountPage/AccountPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { baseQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { z, ZodError, ZodIssueCode } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { discriminatedUnion } from "@/lib/discriminatedUnion"
|
||||
import {
|
||||
cardBlockRefsSchema,
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
|
||||
import {
|
||||
GetCurrentFooter,
|
||||
@@ -16,9 +21,6 @@ import {
|
||||
GetSiteConfigRef,
|
||||
} from "@/lib/graphql/Query/SiteConfig.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
import { langInput } from "@/server/utils"
|
||||
|
||||
import {
|
||||
@@ -51,6 +53,8 @@ import {
|
||||
getSiteConfigConnections,
|
||||
} from "./utils"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type {
|
||||
FooterDataRaw,
|
||||
FooterRefDataRaw,
|
||||
@@ -63,7 +67,6 @@ import type {
|
||||
GetSiteConfigData,
|
||||
GetSiteConfigRefData,
|
||||
} from "@/types/trpc/routers/contentstack/siteConfig"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
const getContactConfig = cache(async (lang: Lang) => {
|
||||
const getContactConfigCounter = createCounter(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { breadcrumbsQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetMyPagesBreadcrumbs,
|
||||
GetMyPagesBreadcrumbsRefs,
|
||||
@@ -37,21 +42,19 @@ import {
|
||||
GetLoyaltyPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { generateRefsResponseTag } from "@/utils/generateTag"
|
||||
|
||||
import { breadcrumbsRefsSchema, breadcrumbsSchema } from "./output"
|
||||
import { getTags } from "./utils"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { PageContentTypeEnum } from "@/types/requests/contentType"
|
||||
import type {
|
||||
BreadcrumbsRefsSchema,
|
||||
RawBreadcrumbsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/breadcrumbs"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
interface BreadcrumbsPageData<T> {
|
||||
dataKey: keyof T
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { generateTag, generateTags } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { campaignPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetCampaignPage,
|
||||
GetCampaignPageRefs,
|
||||
} from "@/lib/graphql/Query/CampaignPage/CampaignPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentStackUidWithServiceProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { generateRefsResponseTag } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { CampaignPageEnum } from "@/types/enums/campaignPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type { CampaignPageRefs } from "@/types/trpc/routers/contentstack/campaignPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export function generatePageTags(
|
||||
validatedData: CampaignPageRefs,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { collectionPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { GetCollectionPage } from "@/lib/graphql/Query/CollectionPage/CollectionPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { collectionPageSchema } from "./output"
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import { GetCollectionPageRefs } from "@/lib/graphql/Query/CollectionPage/CollectionPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
@@ -11,13 +12,14 @@ import {
|
||||
|
||||
import { collectionPageRefsSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { CollectionPageEnum } from "@/types/enums/collectionPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type {
|
||||
CollectionPageRefs,
|
||||
GetCollectionPageRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/collectionPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export async function fetchCollectionPageRefs(lang: Lang, uid: string) {
|
||||
const getCollectionPageRefsCounter = createCounter(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { contentPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { batchRequest } from "@/lib/graphql/batchRequest"
|
||||
import {
|
||||
GetContentPage,
|
||||
GetContentPageBlocksBatch1,
|
||||
GetContentPageBlocksBatch2,
|
||||
} from "@/lib/graphql/Query/ContentPage/ContentPage.graphql"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { contentPageSchema } from "./output"
|
||||
import {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import { batchRequest } from "@/lib/graphql/batchRequest"
|
||||
import {
|
||||
GetContentPageBlocksRefs,
|
||||
GetContentPageRefs,
|
||||
} from "@/lib/graphql/Query/ContentPage/ContentPage.graphql"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
@@ -14,6 +15,8 @@ import {
|
||||
|
||||
import { contentPageRefsSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { TrackingChannelEnum } from "@/types/components/tracking"
|
||||
import { ContentPageEnum } from "@/types/enums/contentPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
@@ -21,7 +24,6 @@ import {
|
||||
type ContentPageRefs,
|
||||
type GetContentPageRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/contentPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export async function fetchContentPageRefs(lang: Lang, uid: string) {
|
||||
const getContentPageRefsCounter = createCounter(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { destinationCityPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetDestinationCityPage,
|
||||
GetDestinationCityPageRefs,
|
||||
} from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentStackUidWithServiceProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { generateRefsResponseTag } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { GetCityPageCount } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql"
|
||||
import { GetCityPageUrls } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
||||
|
||||
import { batchedCityPageUrlsSchema, cityPageCountSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { DestinationCityPageEnum } from "@/types/enums/destinationCityPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type {
|
||||
@@ -14,7 +17,6 @@ import type {
|
||||
GetCityPageCountData,
|
||||
GetCityPageUrlsData,
|
||||
} from "@/types/trpc/routers/contentstack/destinationCityPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export function generatePageTags(
|
||||
validatedData: DestinationCityPageRefs,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { destinationCountryPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
contentStackBaseWithServiceProcedure,
|
||||
contentstackExtendedProcedureUID,
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetDestinationCountryPage,
|
||||
GetDestinationCountryPageRefs,
|
||||
} from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import {
|
||||
contentStackBaseWithServiceProcedure,
|
||||
contentstackExtendedProcedureUID,
|
||||
router,
|
||||
} from "@/server/trpc"
|
||||
|
||||
import { generateRefsResponseTag } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { GetDestinationCityListData } from "@/lib/graphql/Query/DestinationCityPage/DestinationCityListData.graphql"
|
||||
import { GetCountryPageUrls } from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
||||
|
||||
@@ -9,6 +10,8 @@ import { getCitiesByCountry } from "../../hotels/utils"
|
||||
import { destinationCityListDataSchema } from "../destinationCityPage/output"
|
||||
import { countryPageUrlsSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { ApiCountry, type Country } from "@/types/enums/country"
|
||||
import { DestinationCountryPageEnum } from "@/types/enums/destinationCountryPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
@@ -17,7 +20,6 @@ import type {
|
||||
DestinationCountryPageRefs,
|
||||
GetCountryPageUrlsData,
|
||||
} from "@/types/trpc/routers/contentstack/destinationCountryPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export function generatePageTags(
|
||||
validatedData: DestinationCountryPageRefs,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { destinationOverviewPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -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 { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
contentstackExtendedProcedureUID,
|
||||
serviceProcedure,
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import {
|
||||
GetDestinationOverviewPage,
|
||||
GetDestinationOverviewPageRefs,
|
||||
} from "@/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import {
|
||||
contentstackExtendedProcedureUID,
|
||||
router,
|
||||
serviceProcedure,
|
||||
} from "@/server/trpc"
|
||||
|
||||
import { generateRefsResponseTag, generateTag } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { DestinationsData } from "@/types/components/destinationOverviewPage/destinationsList/destinationsData"
|
||||
import { ApiCountry, Country } from "@/types/enums/country"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { hotelPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { GetHotelPage } from "@/lib/graphql/Query/HotelPage/HotelPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { GetHotelPageCount } from "@/lib/graphql/Query/HotelPage/HotelPageCount.graphql"
|
||||
import { GetHotelPageUrls } from "@/lib/graphql/Query/HotelPage/HotelPageUrl.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import { batchedHotelPageUrlsSchema, hotelPageCountSchema } from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type {
|
||||
GetHotelPageCountData,
|
||||
GetHotelPageUrlsData,
|
||||
} from "@/types/trpc/routers/contentstack/hotelPage"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export async function getHotelPageCount(lang: Lang) {
|
||||
const getHotelPageCountCounter = createCounter(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
|
||||
import { accountPageRouter } from "./accountPage"
|
||||
import { baseRouter } from "./base"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { languageSwitcherQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export const getLanguageSwitcherInput = z.object({
|
||||
lang: z.nativeEnum(Lang),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { publicProcedure, router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { publicProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { getUidAndContentTypeByPath } from "@/services/cms/getUidAndContentTypeByPath"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { internalServerError } from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import { batchRequest } from "@/lib/graphql/batchRequest"
|
||||
import {
|
||||
GetDaDeEnUrlsAccountPage,
|
||||
@@ -44,8 +47,6 @@ import {
|
||||
GetDaDeEnUrlsStartPage,
|
||||
GetFiNoSvUrlsStartPage,
|
||||
} from "@/lib/graphql/Query/StartPage/StartPage.graphql"
|
||||
import { internalServerError } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
import { removeTrailingSlash } from "@/utils/url"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { loyaltyLevelQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { MembershipLevelEnum } from "@/constants/membershipLevels"
|
||||
|
||||
export const loyaltyLevelInput = z.object({
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
type MembershipLevel,
|
||||
MembershipLevelEnum,
|
||||
@@ -9,9 +14,6 @@ import {
|
||||
GetLoyaltyLevel,
|
||||
} from "@/lib/graphql/Query/LoyaltyLevels.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { generateLoyaltyConfigTag } from "@/utils/generateTag"
|
||||
|
||||
@@ -22,9 +24,9 @@ import {
|
||||
validateLoyaltyLevelsSchema,
|
||||
} from "./output"
|
||||
|
||||
import type { Context } from "@/server/context"
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export const getAllLoyaltyLevels = cache(async (ctx: Context) => {
|
||||
export const getAllLoyaltyLevels = cache(async (lang: Lang) => {
|
||||
const getLoyaltyLevelAllCounter = createCounter(
|
||||
"trpc.contentstack",
|
||||
"loyaltyLevel.all"
|
||||
@@ -39,12 +41,12 @@ export const getAllLoyaltyLevels = cache(async (ctx: Context) => {
|
||||
const allLevelIds = Object.values(MembershipLevelEnum)
|
||||
|
||||
const tags = allLevelIds.map((levelId) =>
|
||||
generateLoyaltyConfigTag(ctx.lang, "loyalty_level", levelId)
|
||||
generateLoyaltyConfigTag(lang, "loyalty_level", levelId)
|
||||
)
|
||||
|
||||
const loyaltyLevelsConfigResponse = await request<LoyaltyLevelsResponse>(
|
||||
GetAllLoyaltyLevels,
|
||||
{ lang: ctx.lang, level_ids: allLevelIds },
|
||||
{ lang, level_ids: allLevelIds },
|
||||
{ key: tags, ttl: "max" }
|
||||
)
|
||||
|
||||
@@ -68,13 +70,13 @@ export const getAllLoyaltyLevels = cache(async (ctx: Context) => {
|
||||
})
|
||||
|
||||
export const getLoyaltyLevel = cache(
|
||||
async (ctx: Context, level_id: MembershipLevel) => {
|
||||
async (lang: Lang, level_id: MembershipLevel) => {
|
||||
const getLoyaltyLevelCounter = createCounter(
|
||||
"trpc.contentstack",
|
||||
"loyaltyLevel.get"
|
||||
)
|
||||
const metricsGetLoyaltyLevel = getLoyaltyLevelCounter.init({
|
||||
lang: ctx.lang,
|
||||
lang,
|
||||
level_id,
|
||||
})
|
||||
|
||||
@@ -82,9 +84,9 @@ export const getLoyaltyLevel = cache(
|
||||
|
||||
const loyaltyLevelsConfigResponse = await request<LoyaltyLevelsResponse>(
|
||||
GetLoyaltyLevel,
|
||||
{ lang: ctx.lang, level_id },
|
||||
{ lang, level_id },
|
||||
{
|
||||
key: generateLoyaltyConfigTag(ctx.lang, "loyalty_level", level_id),
|
||||
key: generateLoyaltyConfigTag(lang, "loyalty_level", level_id),
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
@@ -116,9 +118,9 @@ export const loyaltyLevelQueryRouter = router({
|
||||
byLevel: contentstackBaseProcedure
|
||||
.input(loyaltyLevelInput)
|
||||
.query(async function ({ ctx, input }) {
|
||||
return getLoyaltyLevel(ctx, input.level)
|
||||
return getLoyaltyLevel(ctx.lang, input.level)
|
||||
}),
|
||||
all: contentstackBaseProcedure.query(async function ({ ctx }) {
|
||||
return getAllLoyaltyLevels(ctx)
|
||||
return getAllLoyaltyLevels(ctx.lang)
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { loyaltyPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetLoyaltyPage,
|
||||
GetLoyaltyPageRefs,
|
||||
} from "@/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { metadataQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ import { getDescription } from "./utils/description"
|
||||
import { getImage } from "./utils/image"
|
||||
import { getTitle } from "./utils/title"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Metadata } from "next"
|
||||
|
||||
import type { ImageVaultAsset } from "@/types/components/imageVault"
|
||||
import { Country } from "@/types/enums/country"
|
||||
import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher"
|
||||
import { RTETypeEnum } from "@/types/rte/enums"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
const metaDataJsonSchema = z.object({
|
||||
children: z.array(
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentStackUidWithServiceProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { GetAccountPageMetadata } from "@/lib/graphql/Query/AccountPage/Metadata.graphql"
|
||||
import { GetCampaignPageMetadata } from "@/lib/graphql/Query/CampaignPage/Metadata.graphql"
|
||||
@@ -12,9 +17,6 @@ import { GetHotelPageMetadata } from "@/lib/graphql/Query/HotelPage/Metadata.gra
|
||||
import { GetLoyaltyPageMetadata } from "@/lib/graphql/Query/LoyaltyPage/Metadata.graphql"
|
||||
import { GetStartPageMetadata } from "@/lib/graphql/Query/StartPage/Metadata.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentStackUidWithServiceProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
@@ -24,12 +26,12 @@ import { getMetadataInput } from "./input"
|
||||
import { getNonContentstackUrls, metadataSchema } from "./output"
|
||||
import { affix, getCityData, getCountryData } from "./utils"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Metadata } from "next"
|
||||
|
||||
import { PageContentTypeEnum } from "@/types/requests/contentType"
|
||||
import type { LanguageSwitcherData } from "@/types/requests/languageSwitcher"
|
||||
import type { RawMetadataSchema } from "@/types/trpc/routers/contentstack/metadata"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
const fetchMetadata = cache(async function fetchMemoizedMetadata<T>(
|
||||
query: string,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { type Lang } from "@/constants/languages"
|
||||
import {
|
||||
getFiltersFromHotels,
|
||||
getSortedCities,
|
||||
@@ -12,6 +11,8 @@ import {
|
||||
} from "../../../hotels/utils"
|
||||
import { getCityPages } from "../../destinationCountryPage/utils"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { ApiCountry } from "@/types/enums/country"
|
||||
import { SortOption } from "@/types/enums/destinationFilterAndSort"
|
||||
import type {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { pageSettingsQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetAccountPageSettings,
|
||||
GetCampaignPageSettings,
|
||||
@@ -14,7 +17,6 @@ import {
|
||||
GetStartPageSettings,
|
||||
} from "@/lib/graphql/Query/PageSettings.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
import { langInput } from "@/server/utils"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { partnerQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
import { cache } from "react"
|
||||
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackBaseProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { GetAllSasTierComparison } from "@/lib/graphql/Query/SASTierComparison.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
|
||||
import { validateSasTierComparisonSchema } from "./output"
|
||||
|
||||
import type { SasTierComparisonResponse } from "@/types/trpc/routers/contentstack/partner"
|
||||
import type { Context } from "@/server/context"
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export const getSasTierComparison = cache(async (ctx: Context) => {
|
||||
import type { SasTierComparisonResponse } from "@/types/trpc/routers/contentstack/partner"
|
||||
|
||||
export const getSasTierComparison = cache(async (lang: Lang) => {
|
||||
const getSasTierComparisonCounter = createCounter(
|
||||
"trpc.contentstack",
|
||||
"partner.getSasTierComparison"
|
||||
)
|
||||
const metricsGetSasTierComparison = getSasTierComparisonCounter.init({
|
||||
lang: ctx.lang,
|
||||
lang,
|
||||
})
|
||||
|
||||
metricsGetSasTierComparison.start()
|
||||
|
||||
const tag = `${ctx.lang}:sas_tier_comparison`
|
||||
const tag = `${lang}:sas_tier_comparison`
|
||||
const sasTierComparisonConfigResponse =
|
||||
await request<SasTierComparisonResponse>(
|
||||
GetAllSasTierComparison,
|
||||
{ lang: ctx.lang },
|
||||
{ lang },
|
||||
{
|
||||
key: tag,
|
||||
ttl: "max",
|
||||
@@ -59,6 +62,6 @@ export const partnerQueryRouter = router({
|
||||
getSasTierComparison: contentstackBaseProcedure.query(async function ({
|
||||
ctx,
|
||||
}) {
|
||||
return getSasTierComparison(ctx)
|
||||
return getSasTierComparison(ctx.lang)
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { rewardQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import * as api from "@/lib/api"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
contentStackBaseWithProtectedProcedure,
|
||||
contentStackBaseWithServiceProcedure,
|
||||
protectedProcedure,
|
||||
router,
|
||||
} from "@/server/trpc"
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { langInput } from "@/server/utils"
|
||||
|
||||
import {
|
||||
@@ -64,7 +65,7 @@ export const rewardQueryRouter = router({
|
||||
return []
|
||||
}
|
||||
|
||||
const loyaltyLevelsConfig = await getAllLoyaltyLevels(ctx)
|
||||
const loyaltyLevelsConfig = await getAllLoyaltyLevels(ctx.lang)
|
||||
const levelsWithRewards = Object.entries(allApiRewards).map(
|
||||
([level, rewards]) => {
|
||||
const combinedRewards = rewards
|
||||
@@ -150,7 +151,7 @@ export const rewardQueryRouter = router({
|
||||
|
||||
const [contentStackRewards, loyaltyLevelsConfig] = await Promise.all([
|
||||
getCmsRewards(ctx.lang, rewardIds),
|
||||
getLoyaltyLevel(ctx, input.level_id),
|
||||
getLoyaltyLevel(ctx.lang, input.level_id),
|
||||
])
|
||||
|
||||
if (!contentStackRewards) {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import {
|
||||
@@ -6,8 +8,6 @@ import {
|
||||
GetRewardsRef as GetRewardsRef,
|
||||
} from "@/lib/graphql/Query/RewardsWithRedeem.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
|
||||
import {
|
||||
generateLoyaltyConfigTag,
|
||||
@@ -20,11 +20,12 @@ import {
|
||||
validateCmsRewardsSchema,
|
||||
} from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type {
|
||||
CMSRewardsResponse,
|
||||
GetRewardRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/reward"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export function getUniqueRewardIds(rewardIds: string[]) {
|
||||
const uniqueRewardIds = new Set(rewardIds)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export const systemSchema = z.object({
|
||||
content_type_uid: z.string(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { startPageQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { notFound } from "@scandic-hotels/trpc/errors"
|
||||
import { contentstackExtendedProcedureUID } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import {
|
||||
GetStartPage,
|
||||
GetStartPageRefs,
|
||||
} from "@/lib/graphql/Query/StartPage/StartPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import {
|
||||
generateRefsResponseTag,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { hotelQueryRouter } from "./query"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import dayjs from "dayjs"
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { env } from "@/env/server"
|
||||
import * as api from "@/lib/api"
|
||||
import { dt } from "@/lib/dt"
|
||||
import { badRequestError, unauthorizedError } from "@/server/errors/trpc"
|
||||
import { getCityPageUrls } from "@/server/routers/contentstack/destinationCityPage/utils"
|
||||
import { getVerifiedUser } from "@/server/routers/user/utils"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { badRequestError, unauthorizedError } from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
contentStackBaseWithServiceProcedure,
|
||||
publicProcedure,
|
||||
router,
|
||||
safeProtectedServiceProcedure,
|
||||
serviceProcedure,
|
||||
} from "@/server/trpc"
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { REDEMPTION } from "@/constants/booking"
|
||||
import { env } from "@/env/server"
|
||||
import * as api from "@/lib/api"
|
||||
import { dt } from "@/lib/dt"
|
||||
import { getCityPageUrls } from "@/server/routers/contentstack/destinationCityPage/utils"
|
||||
import { getVerifiedUser } from "@/server/routers/user/utils"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { getHotelPageUrls } from "../contentstack/hotelPage/utils"
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import deepmerge from "deepmerge"
|
||||
import stringify from "json-stable-stringify-without-jsonify"
|
||||
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { badRequestError } from "@scandic-hotels/trpc/errors"
|
||||
|
||||
import { BookingErrorCodeEnum, REDEMPTION } from "@/constants/booking"
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { selectRate } from "@/constants/routes/hotelReservation"
|
||||
import { env } from "@/env/server"
|
||||
import * as api from "@/lib/api"
|
||||
import { badRequestError } from "@/server/errors/trpc"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { generateChildrenString } from "@/components/HotelReservation/utils"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
|
||||
import { myPagesNavigation } from "./mypages/index"
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ import { env } from "@/env/server"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { getEurobonusMembership } from "@/utils/user"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { UserLoyalty } from "@/types/user"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { MyPagesLink } from "./MyPagesLink"
|
||||
|
||||
export const getPrimaryLinks = cache(
|
||||
|
||||
@@ -2,7 +2,8 @@ import * as routes from "@/constants/routes/myPages"
|
||||
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { MyPagesLink } from "./MyPagesLink"
|
||||
|
||||
export async function getSecondaryLinks({
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { TRPCError } from "@trpc/server"
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { safeProtectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { getVerifiedUser } from "@/server/routers/user/utils"
|
||||
import { safeProtectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { isValidSession } from "@/utils/session"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
|
||||
import { jobylonQueryRouter } from "./jobylon/query"
|
||||
import { sasRouter } from "./sas"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { publicProcedure, router } from "@/server/trpc"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { publicProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { jobylonFeedSchema } from "./output"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { router } from "@/server/trpc"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
|
||||
import { requestOtp } from "./otp/request/requestOtp"
|
||||
import { verifyOtp } from "./otp/verify/verifyOtp"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getOTPState } from "./otp/getOTPState"
|
||||
import { getSasToken } from "./getSasToken"
|
||||
|
||||
@@ -4,8 +4,9 @@ import { cookies } from "next/headers"
|
||||
import { v4 as uuidv4 } from "uuid"
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getSasToken } from "../../getSasToken"
|
||||
import { SAS_REQUEST_OTP_STATE_STORAGE_COOKIE_NAME } from "../constants"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { TRPCError } from "@trpc/server"
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getSasToken } from "../../getSasToken"
|
||||
import { getOTPState } from "../getOTPState"
|
||||
|
||||
@@ -2,9 +2,10 @@ import * as Sentry from "@sentry/nextjs"
|
||||
import { cookies } from "next/headers"
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { FriendsMembershipLevels } from "@/constants/membershipLevels"
|
||||
import * as api from "@/lib/api"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getUserSchema } from "../../user/output"
|
||||
import { getVerifiedUser } from "../../user/utils"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getOTPState } from "./otp/getOTPState"
|
||||
// import * as api from "@/lib/api"
|
||||
import { getSasToken } from "./getSasToken"
|
||||
|
||||
const outputSchema = z.object({
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { protectedProcedure } from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getOTPState } from "./otp/getOTPState"
|
||||
import { getSasToken } from "./getSasToken"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
import { mergeRouters } from "@scandic-hotels/trpc"
|
||||
|
||||
import { userMutationRouter } from "./mutation"
|
||||
import { userQueryRouter } from "./query"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import { signUpSchema } from "@/components/Forms/Signup/schema"
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import { serverErrorByStatus } from "@scandic-hotels/trpc/errors"
|
||||
import {
|
||||
protectedProcedure,
|
||||
serviceProcedure,
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import { signupVerify } from "@/constants/routes/signup"
|
||||
import { env } from "@/env/server"
|
||||
import * as api from "@/lib/api"
|
||||
import { serverErrorByStatus } from "@/server/errors/trpc"
|
||||
import {
|
||||
initiateSaveCardSchema,
|
||||
subscriberIdSchema,
|
||||
} from "@/server/routers/user/output"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { protectedProcedure, router, serviceProcedure } from "@/server/trpc"
|
||||
|
||||
import {
|
||||
addCreditCardInput,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import * as api from "@/lib/api"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { router } from "@scandic-hotels/trpc"
|
||||
import {
|
||||
languageProtectedProcedure,
|
||||
protectedProcedure,
|
||||
router,
|
||||
safeProtectedProcedure,
|
||||
} from "@/server/trpc"
|
||||
} from "@scandic-hotels/trpc/procedures"
|
||||
|
||||
import * as api from "@/lib/api"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { isValidSession } from "@/utils/session"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { countries } from "@/constants/countries"
|
||||
import { myBookingPath } from "@/constants/myBooking"
|
||||
import { myStay } from "@/constants/routes/myStay"
|
||||
import { env } from "@/env/server"
|
||||
import * as api from "@/lib/api"
|
||||
import { dt } from "@/lib/dt"
|
||||
import { createCounter } from "@/server/telemetry"
|
||||
import { toApiLang } from "@/server/utils"
|
||||
|
||||
import { cache } from "@/utils/cache"
|
||||
@@ -22,10 +23,10 @@ import {
|
||||
type Stay,
|
||||
} from "./output"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Session } from "next-auth"
|
||||
|
||||
import type { User } from "@/types/user"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export const getVerifiedUser = cache(
|
||||
async ({
|
||||
|
||||
Reference in New Issue
Block a user