Merged in feat/SW-1449-destination-page (pull request #1195)
Feat/SW-1449 destination page * feat(SW-1449): Added destination country page * feat(SW-1449): added destination city page Approved-by: Fredrik Thorsson Approved-by: Matilda Landström
This commit is contained in:
@@ -14,6 +14,8 @@ export const validateBookingWidgetToggleSchema = z.object({
|
||||
content_page: bookingWidgetToggleSchema,
|
||||
current_blocks_page: bookingWidgetToggleSchema,
|
||||
destination_overview_page: bookingWidgetToggleSchema,
|
||||
destination_country_page: bookingWidgetToggleSchema,
|
||||
destination_city_page: bookingWidgetToggleSchema,
|
||||
hotel_page: bookingWidgetToggleSchema,
|
||||
loyalty_page: bookingWidgetToggleSchema,
|
||||
})
|
||||
|
||||
@@ -3,6 +3,8 @@ import {
|
||||
GetCollectionPageSettings,
|
||||
GetContentPageSettings,
|
||||
GetCurrentBlocksPageSettings,
|
||||
GetDestinationCityPageSettings,
|
||||
GetDestinationCountryPageSettings,
|
||||
GetDestinationOverviewPageSettings,
|
||||
GetHotelPageSettings,
|
||||
GetLoyaltyPageSettings,
|
||||
@@ -54,6 +56,12 @@ export const bookingwidgetQueryRouter = router({
|
||||
case PageContentTypeEnum.destinationOverviewPage:
|
||||
GetPageSettings = GetDestinationOverviewPageSettings
|
||||
break
|
||||
case PageContentTypeEnum.destinationCountryPage:
|
||||
GetPageSettings = GetDestinationCountryPageSettings
|
||||
break
|
||||
case PageContentTypeEnum.destinationCityPage:
|
||||
GetPageSettings = GetDestinationCityPageSettings
|
||||
break
|
||||
case PageContentTypeEnum.hotelPage:
|
||||
GetPageSettings = GetHotelPageSettings
|
||||
break
|
||||
|
||||
@@ -13,6 +13,14 @@ import {
|
||||
GetContentPageBreadcrumbs,
|
||||
GetContentPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/Breadcrumbs/ContentPage.graphql"
|
||||
import {
|
||||
GetDestinationCityPageBreadcrumbs,
|
||||
GetDestinationCityPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql"
|
||||
import {
|
||||
GetDestinationCountryPageBreadcrumbs,
|
||||
GetDestinationCountryPageBreadcrumbsRefs,
|
||||
} from "@/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql"
|
||||
import {
|
||||
GetDestinationOverviewPageBreadcrumbs,
|
||||
GetDestinationOverviewPageBreadcrumbsRefs,
|
||||
@@ -218,6 +226,28 @@ export const breadcrumbsQueryRouter = router({
|
||||
},
|
||||
variables
|
||||
)
|
||||
case PageContentTypeEnum.destinationCountryPage:
|
||||
return await getBreadcrumbs<{
|
||||
destination_country_page: RawBreadcrumbsSchema
|
||||
}>(
|
||||
{
|
||||
dataKey: "destination_country_page",
|
||||
refQuery: GetDestinationCountryPageBreadcrumbsRefs,
|
||||
query: GetDestinationCountryPageBreadcrumbs,
|
||||
},
|
||||
variables
|
||||
)
|
||||
case PageContentTypeEnum.destinationCityPage:
|
||||
return await getBreadcrumbs<{
|
||||
destination_city_page: RawBreadcrumbsSchema
|
||||
}>(
|
||||
{
|
||||
dataKey: "destination_city_page",
|
||||
refQuery: GetDestinationCityPageBreadcrumbsRefs,
|
||||
query: GetDestinationCityPageBreadcrumbs,
|
||||
},
|
||||
variables
|
||||
)
|
||||
case PageContentTypeEnum.hotelPage:
|
||||
return await getBreadcrumbs<{
|
||||
hotel_page: RawBreadcrumbsSchema
|
||||
|
||||
7
server/routers/contentstack/destinationCityPage/index.ts
Normal file
7
server/routers/contentstack/destinationCityPage/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
|
||||
import { destinationCityPageQueryRouter } from "./query"
|
||||
|
||||
export const destinationCityPageRouter = mergeRouters(
|
||||
destinationCityPageQueryRouter
|
||||
)
|
||||
25
server/routers/contentstack/destinationCityPage/output.ts
Normal file
25
server/routers/contentstack/destinationCityPage/output.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
export const destinationCityPageSchema = z.object({
|
||||
destination_city_page: z.object({
|
||||
title: z.string(),
|
||||
system: systemSchema.merge(
|
||||
z.object({
|
||||
created_at: z.string(),
|
||||
updated_at: z.string(),
|
||||
})
|
||||
),
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
/** REFS */
|
||||
export const destinationCityPageRefsSchema = z.object({
|
||||
destination_city_page: z.object({
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
179
server/routers/contentstack/destinationCityPage/query.ts
Normal file
179
server/routers/contentstack/destinationCityPage/query.ts
Normal file
@@ -0,0 +1,179 @@
|
||||
import {
|
||||
GetDestinationCityPage,
|
||||
GetDestinationCityPageRefs,
|
||||
} from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
import {
|
||||
destinationCityPageRefsSchema,
|
||||
destinationCityPageSchema,
|
||||
} from "./output"
|
||||
import {
|
||||
getDestinationCityPageCounter,
|
||||
getDestinationCityPageFailCounter,
|
||||
getDestinationCityPageRefsCounter,
|
||||
getDestinationCityPageRefsFailCounter,
|
||||
getDestinationCityPageRefsSuccessCounter,
|
||||
getDestinationCityPageSuccessCounter,
|
||||
} from "./telemetry"
|
||||
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type {
|
||||
GetDestinationCityPageData,
|
||||
GetDestinationCityPageRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/destinationCityPage"
|
||||
|
||||
export const destinationCityPageQueryRouter = router({
|
||||
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||
const { lang, uid } = ctx
|
||||
|
||||
getDestinationCityPageRefsCounter.add(1, { lang, uid })
|
||||
console.info(
|
||||
"contentstack.destinationCityPage.refs start",
|
||||
JSON.stringify({ query: { lang, uid } })
|
||||
)
|
||||
|
||||
const refsResponse = await request<GetDestinationCityPageRefsSchema>(
|
||||
GetDestinationCityPageRefs,
|
||||
{ locale: lang, uid },
|
||||
{
|
||||
cache: "force-cache",
|
||||
next: {
|
||||
tags: [generateTag(lang, uid)],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
getDestinationCityPageRefsFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "not_found",
|
||||
error: JSON.stringify({ code: notFoundError.code }),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCityPage.refs not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedRefsData = destinationCityPageRefsSchema.safeParse(
|
||||
refsResponse.data
|
||||
)
|
||||
if (!validatedRefsData.success) {
|
||||
getDestinationCityPageRefsFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "validation_error",
|
||||
error: JSON.stringify(validatedRefsData.error),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCityPage.refs validation error",
|
||||
JSON.stringify({ query: { lang, uid }, error: validatedRefsData.error })
|
||||
)
|
||||
return null
|
||||
}
|
||||
getDestinationCityPageRefsSuccessCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCityPage.refs success",
|
||||
JSON.stringify({ query: { lang, uid } })
|
||||
)
|
||||
|
||||
getDestinationCityPageCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCityPage start",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
const response = await request<GetDestinationCityPageData>(
|
||||
GetDestinationCityPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
{
|
||||
cache: "force-cache",
|
||||
next: {
|
||||
tags: [generateTag(lang, uid)],
|
||||
},
|
||||
}
|
||||
)
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
getDestinationCityPageFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "not_found",
|
||||
error: JSON.stringify({ code: notFoundError.code }),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCityPage not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const destinationCityPage = destinationCityPageSchema.safeParse(
|
||||
response.data
|
||||
)
|
||||
|
||||
if (!destinationCityPage.success) {
|
||||
getDestinationCityPageFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "validation_error",
|
||||
error: JSON.stringify(destinationCityPage.error),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCityPage validation error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: destinationCityPage.error,
|
||||
})
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
getDestinationCityPageSuccessCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCityPage success",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
|
||||
const system = destinationCityPage.data.destination_city_page.system
|
||||
const tracking: TrackingSDKPageData = {
|
||||
pageId: system.uid,
|
||||
domainLanguage: lang,
|
||||
publishDate: system.updated_at,
|
||||
createDate: system.created_at,
|
||||
channel: TrackingChannelEnum["destination-page"],
|
||||
pageType: "staticcontentpage",
|
||||
pageName: destinationCityPage.data.trackingProps.url,
|
||||
siteSections: destinationCityPage.data.trackingProps.url,
|
||||
siteVersion: "new-web",
|
||||
}
|
||||
|
||||
return {
|
||||
destinationCityPage: destinationCityPage.data.destination_city_page,
|
||||
tracking,
|
||||
}
|
||||
}),
|
||||
})
|
||||
23
server/routers/contentstack/destinationCityPage/telemetry.ts
Normal file
23
server/routers/contentstack/destinationCityPage/telemetry.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { metrics } from "@opentelemetry/api"
|
||||
|
||||
const meter = metrics.getMeter("trpc.contentstack.destinationCityPage")
|
||||
|
||||
export const getDestinationCityPageRefsCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get"
|
||||
)
|
||||
export const getDestinationCityPageRefsFailCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get-fail"
|
||||
)
|
||||
export const getDestinationCityPageRefsSuccessCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get-success"
|
||||
)
|
||||
|
||||
export const getDestinationCityPageCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get"
|
||||
)
|
||||
export const getDestinationCityPageSuccessCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get-success"
|
||||
)
|
||||
export const getDestinationCityPageFailCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCityPage.get-fail"
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { mergeRouters } from "@/server/trpc"
|
||||
|
||||
import { destinationCountryPageQueryRouter } from "./query"
|
||||
|
||||
export const destinationCountryPageRouter = mergeRouters(
|
||||
destinationCountryPageQueryRouter
|
||||
)
|
||||
25
server/routers/contentstack/destinationCountryPage/output.ts
Normal file
25
server/routers/contentstack/destinationCountryPage/output.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { systemSchema } from "../schemas/system"
|
||||
|
||||
export const destinationCountryPageSchema = z.object({
|
||||
destination_country_page: z.object({
|
||||
title: z.string(),
|
||||
system: systemSchema.merge(
|
||||
z.object({
|
||||
created_at: z.string(),
|
||||
updated_at: z.string(),
|
||||
})
|
||||
),
|
||||
}),
|
||||
trackingProps: z.object({
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
|
||||
/** REFS */
|
||||
export const destinationCountryPageRefsSchema = z.object({
|
||||
destination_country_page: z.object({
|
||||
system: systemSchema,
|
||||
}),
|
||||
})
|
||||
180
server/routers/contentstack/destinationCountryPage/query.ts
Normal file
180
server/routers/contentstack/destinationCountryPage/query.ts
Normal file
@@ -0,0 +1,180 @@
|
||||
import {
|
||||
GetDestinationCountryPage,
|
||||
GetDestinationCountryPageRefs,
|
||||
} from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { notFound } from "@/server/errors/trpc"
|
||||
import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
import {
|
||||
destinationCountryPageRefsSchema,
|
||||
destinationCountryPageSchema,
|
||||
} from "./output"
|
||||
import {
|
||||
getDestinationCountryPageCounter,
|
||||
getDestinationCountryPageFailCounter,
|
||||
getDestinationCountryPageRefsCounter,
|
||||
getDestinationCountryPageRefsFailCounter,
|
||||
getDestinationCountryPageRefsSuccessCounter,
|
||||
getDestinationCountryPageSuccessCounter,
|
||||
} from "./telemetry"
|
||||
|
||||
import {
|
||||
TrackingChannelEnum,
|
||||
type TrackingSDKPageData,
|
||||
} from "@/types/components/tracking"
|
||||
import type {
|
||||
GetDestinationCountryPageData,
|
||||
GetDestinationCountryPageRefsSchema,
|
||||
} from "@/types/trpc/routers/contentstack/destinationCountryPage"
|
||||
|
||||
export const destinationCountryPageQueryRouter = router({
|
||||
get: contentstackExtendedProcedureUID.query(async ({ ctx }) => {
|
||||
const { lang, uid } = ctx
|
||||
|
||||
getDestinationCountryPageRefsCounter.add(1, { lang, uid })
|
||||
console.info(
|
||||
"contentstack.destinationCountryPage.refs start",
|
||||
JSON.stringify({ query: { lang, uid } })
|
||||
)
|
||||
|
||||
const refsResponse = await request<GetDestinationCountryPageRefsSchema>(
|
||||
GetDestinationCountryPageRefs,
|
||||
{ locale: lang, uid },
|
||||
{
|
||||
cache: "force-cache",
|
||||
next: {
|
||||
tags: [generateTag(lang, uid)],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
getDestinationCountryPageRefsFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "not_found",
|
||||
error: JSON.stringify({ code: notFoundError.code }),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCountryPage.refs not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedRefsData = destinationCountryPageRefsSchema.safeParse(
|
||||
refsResponse.data
|
||||
)
|
||||
if (!validatedRefsData.success) {
|
||||
getDestinationCountryPageRefsFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "validation_error",
|
||||
error: JSON.stringify(validatedRefsData.error),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCountryPage.refs validation error",
|
||||
JSON.stringify({ query: { lang, uid }, error: validatedRefsData.error })
|
||||
)
|
||||
return null
|
||||
}
|
||||
getDestinationCountryPageRefsSuccessCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCountryPage.refs success",
|
||||
JSON.stringify({ query: { lang, uid } })
|
||||
)
|
||||
|
||||
getDestinationCountryPageCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCountryPage start",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
const response = await request<GetDestinationCountryPageData>(
|
||||
GetDestinationCountryPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
{
|
||||
cache: "force-cache",
|
||||
next: {
|
||||
tags: [generateTag(lang, uid)],
|
||||
},
|
||||
}
|
||||
)
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
getDestinationCountryPageFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "not_found",
|
||||
error: JSON.stringify({ code: notFoundError.code }),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCountryPage not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const destinationCountryPage = destinationCountryPageSchema.safeParse(
|
||||
response.data
|
||||
)
|
||||
|
||||
if (!destinationCountryPage.success) {
|
||||
getDestinationCountryPageFailCounter.add(1, {
|
||||
lang,
|
||||
uid: `${uid}`,
|
||||
error_type: "validation_error",
|
||||
error: JSON.stringify(destinationCountryPage.error),
|
||||
})
|
||||
console.error(
|
||||
"contentstack.destinationCountryPage validation error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: destinationCountryPage.error,
|
||||
})
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
getDestinationCountryPageSuccessCounter.add(1, { lang, uid: `${uid}` })
|
||||
console.info(
|
||||
"contentstack.destinationCountryPage success",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
})
|
||||
)
|
||||
|
||||
const system = destinationCountryPage.data.destination_country_page.system
|
||||
const tracking: TrackingSDKPageData = {
|
||||
pageId: system.uid,
|
||||
domainLanguage: lang,
|
||||
publishDate: system.updated_at,
|
||||
createDate: system.created_at,
|
||||
channel: TrackingChannelEnum["destination-page"],
|
||||
pageType: "staticcontentpage",
|
||||
pageName: destinationCountryPage.data.trackingProps.url,
|
||||
siteSections: destinationCountryPage.data.trackingProps.url,
|
||||
siteVersion: "new-web",
|
||||
}
|
||||
|
||||
return {
|
||||
destinationCountryPage:
|
||||
destinationCountryPage.data.destination_country_page,
|
||||
tracking,
|
||||
}
|
||||
}),
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
import { metrics } from "@opentelemetry/api"
|
||||
|
||||
const meter = metrics.getMeter("trpc.contentstack.destinationCountryPage")
|
||||
|
||||
export const getDestinationCountryPageRefsCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get"
|
||||
)
|
||||
export const getDestinationCountryPageRefsFailCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get-fail"
|
||||
)
|
||||
export const getDestinationCountryPageRefsSuccessCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get-success"
|
||||
)
|
||||
|
||||
export const getDestinationCountryPageCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get"
|
||||
)
|
||||
export const getDestinationCountryPageSuccessCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get-success"
|
||||
)
|
||||
export const getDestinationCountryPageFailCounter = meter.createCounter(
|
||||
"trpc.contentstack.destinationCountryPage.get-fail"
|
||||
)
|
||||
@@ -6,6 +6,8 @@ import { bookingwidgetRouter } from "./bookingwidget"
|
||||
import { breadcrumbsRouter } from "./breadcrumbs"
|
||||
import { collectionPageRouter } from "./collectionPage"
|
||||
import { contentPageRouter } from "./contentPage"
|
||||
import { destinationCityPageRouter } from "./destinationCityPage"
|
||||
import { destinationCountryPageRouter } from "./destinationCountryPage"
|
||||
import { destinationOverviewPageRouter } from "./destinationOverviewPage"
|
||||
import { hotelPageRouter } from "./hotelPage"
|
||||
import { languageSwitcherRouter } from "./languageSwitcher"
|
||||
@@ -26,6 +28,8 @@ export const contentstackRouter = router({
|
||||
collectionPage: collectionPageRouter,
|
||||
contentPage: contentPageRouter,
|
||||
destinationOverviewPage: destinationOverviewPageRouter,
|
||||
destinationCountryPage: destinationCountryPageRouter,
|
||||
destinationCityPage: destinationCityPageRouter,
|
||||
myPages: myPagesRouter,
|
||||
metadata: metadataRouter,
|
||||
rewards: rewardRouter,
|
||||
|
||||
@@ -19,6 +19,14 @@ import {
|
||||
GetDaDeEnUrlsCurrentBlocksPage,
|
||||
GetFiNoSvUrlsCurrentBlocksPage,
|
||||
} from "@/lib/graphql/Query/Current/LanguageSwitcher.graphql"
|
||||
import {
|
||||
GetDaDeEnUrlsDestinationCityPage,
|
||||
GetFiNoSvUrlsDestinationCityPage,
|
||||
} from "@/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql"
|
||||
import {
|
||||
GetDaDeEnUrlsDestinationCountryPage,
|
||||
GetFiNoSvUrlsDestinationCountryPage,
|
||||
} from "@/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql"
|
||||
import {
|
||||
GetDaDeEnUrlsDestinationOverviewPage,
|
||||
GetFiNoSvUrlsDestinationOverviewPage,
|
||||
@@ -104,6 +112,14 @@ async function getLanguageSwitcher(options: LanguageSwitcherVariables) {
|
||||
daDeEnDocument = GetDaDeEnUrlsDestinationOverviewPage
|
||||
fiNoSvDocument = GetFiNoSvUrlsDestinationOverviewPage
|
||||
break
|
||||
case PageContentTypeEnum.destinationCountryPage:
|
||||
daDeEnDocument = GetDaDeEnUrlsDestinationCountryPage
|
||||
fiNoSvDocument = GetFiNoSvUrlsDestinationCountryPage
|
||||
break
|
||||
case PageContentTypeEnum.destinationCityPage:
|
||||
daDeEnDocument = GetDaDeEnUrlsDestinationCityPage
|
||||
fiNoSvDocument = GetFiNoSvUrlsDestinationCityPage
|
||||
break
|
||||
default:
|
||||
console.error(`type: [${options.contentType}]`)
|
||||
console.error(`Trying to get a content type that is not supported`)
|
||||
|
||||
@@ -4,6 +4,8 @@ import { cache } from "react"
|
||||
import { GetAccountPageMetadata } from "@/lib/graphql/Query/AccountPage/Metadata.graphql"
|
||||
import { GetCollectionPageMetadata } from "@/lib/graphql/Query/CollectionPage/Metadata.graphql"
|
||||
import { GetContentPageMetadata } from "@/lib/graphql/Query/ContentPage/Metadata.graphql"
|
||||
import { GetDestinationCityPageMetadata } from "@/lib/graphql/Query/DestinationCityPage/Metadata.graphql"
|
||||
import { GetDestinationCountryPageMetadata } from "@/lib/graphql/Query/DestinationCountryPage/Metadata.graphql"
|
||||
import { GetDestinationOverviewPageMetadata } from "@/lib/graphql/Query/DestinationOverviewPage/Metadata.graphql"
|
||||
import { GetHotelPageMetadata } from "@/lib/graphql/Query/HotelPage/Metadata.graphql"
|
||||
import { GetLoyaltyPageMetadata } from "@/lib/graphql/Query/LoyaltyPage/Metadata.graphql"
|
||||
@@ -144,6 +146,20 @@ export const metadataQueryRouter = router({
|
||||
return getTransformedMetadata(
|
||||
destinationOverviewPageResponse.destination_overview_page
|
||||
)
|
||||
case PageContentTypeEnum.destinationCountryPage:
|
||||
const destinationCountryPageResponse = await fetchMetadata<{
|
||||
destination_country_page: RawMetadataSchema
|
||||
}>(GetDestinationCountryPageMetadata, variables)
|
||||
return getTransformedMetadata(
|
||||
destinationCountryPageResponse.destination_country_page
|
||||
)
|
||||
case PageContentTypeEnum.destinationCityPage:
|
||||
const destinationCityPageResponse = await fetchMetadata<{
|
||||
destination_city_page: RawMetadataSchema
|
||||
}>(GetDestinationCityPageMetadata, variables)
|
||||
return getTransformedMetadata(
|
||||
destinationCityPageResponse.destination_city_page
|
||||
)
|
||||
case PageContentTypeEnum.loyaltyPage:
|
||||
const loyaltyPageResponse = await fetchMetadata<{
|
||||
loyalty_page: RawMetadataSchema
|
||||
|
||||
Reference in New Issue
Block a user