feat(SW-2973): Added bookingCode if available to links inside campaign pages
* feat(SW-2973): Moved block types to trpc lib Approved-by: Matilda Landström
This commit is contained in:
@@ -24,6 +24,7 @@ import styles from "./campaignHotelListing.module.css"
|
||||
interface CampaignHotelListingClientProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile: 3 | 6
|
||||
visibleCountDesktop: 3 | 6
|
||||
isMainBlock: boolean
|
||||
@@ -35,6 +36,7 @@ export default function CampaignHotelListingClient({
|
||||
visibleCountMobile,
|
||||
visibleCountDesktop,
|
||||
isMainBlock,
|
||||
bookingCode,
|
||||
}: CampaignHotelListingClientProps) {
|
||||
const intl = useIntl()
|
||||
const isMobile = useMediaQuery("(max-width: 767px)")
|
||||
@@ -119,16 +121,24 @@ export default function CampaignHotelListingClient({
|
||||
) : null}
|
||||
</header>
|
||||
<ul className={styles.list}>
|
||||
{activeHotels.map(({ hotel, url }, index) => (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem hotel={hotel} url={url} />
|
||||
</li>
|
||||
))}
|
||||
{activeHotels.map(({ hotel, url }, index) => {
|
||||
const urlWithOptionalBookingCode = bookingCode
|
||||
? `${url}?bookingCode=${bookingCode}`
|
||||
: url
|
||||
return (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem
|
||||
hotel={hotel}
|
||||
url={urlWithOptionalBookingCode}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{showButton ? (
|
||||
|
||||
@@ -19,6 +19,7 @@ interface CampaignHotelListingProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
hotelIds: string[]
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile?: 3 | 6
|
||||
visibleCountDesktop?: 3 | 6
|
||||
isMainBlock?: boolean
|
||||
@@ -28,6 +29,7 @@ export default async function CampaignHotelListing({
|
||||
heading,
|
||||
preamble,
|
||||
hotelIds,
|
||||
bookingCode,
|
||||
visibleCountMobile = 3,
|
||||
visibleCountDesktop = 6,
|
||||
isMainBlock = false,
|
||||
@@ -66,6 +68,7 @@ export default async function CampaignHotelListing({
|
||||
<CampaignHotelListingClient
|
||||
heading={heading}
|
||||
preamble={preamble}
|
||||
bookingCode={bookingCode}
|
||||
visibleCountMobile={visibleCountMobile}
|
||||
visibleCountDesktop={visibleCountDesktop}
|
||||
isMainBlock={isMainBlock}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CampaignHotelListing from "@/components/Blocks/CampaignHotelListing"
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import AccordionSection from "@/components/Blocks/Accordion"
|
||||
import CampaignHotelListing from "@/components/Blocks/CampaignHotelListing"
|
||||
@@ -8,7 +8,11 @@ import CampaignHotelListingSkeleton from "@/components/Blocks/CampaignHotelListi
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
import Essentials from "@/components/Blocks/Essentials"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/blocks"
|
||||
import type { Block as CampaignPageBlock } from "@scandic-hotels/trpc/types/campaignPage"
|
||||
|
||||
interface BlocksProps {
|
||||
blocks: CampaignPageBlock[]
|
||||
}
|
||||
|
||||
export default function Blocks({ blocks }: BlocksProps) {
|
||||
return blocks.map(async (block) => {
|
||||
@@ -39,6 +43,7 @@ export default function Blocks({ blocks }: BlocksProps) {
|
||||
heading={block.hotel_listing.heading}
|
||||
hotelIds={block.hotel_listing.hotelIds}
|
||||
isMainBlock={true}
|
||||
bookingCode={block.hotel_listing.bookingCode}
|
||||
/>
|
||||
</Suspense>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import { useDestinationDataStore } from "@/stores/destination-data"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Title from "@scandic-hotels/design-system/Title"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import { getStartPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent"
|
||||
|
||||
import Overview from "@/components/Blocks/DynamicContent/Overview"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||
import DynamicContent from "@/components/Blocks/DynamicContent"
|
||||
@@ -8,7 +8,6 @@ import { getLang } from "@/i18n/serverContext"
|
||||
import { modWebviewLink } from "@/utils/webviews"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/blocks"
|
||||
// import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export default async function Blocks({ blocks }: BlocksProps) {
|
||||
const lang = await getLang()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import type { CardGallery } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { CardGallery } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface CardGalleryProps extends Pick<CardGallery, "card_gallery"> {}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import type { CardsGrid } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { CardsGrid } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface CardsGridProps extends Pick<CardsGrid, "cards_grid"> {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CarouselCards } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { CarouselCards } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface CarouselCardsProps
|
||||
extends Pick<CarouselCards, "carousel_cards"> {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { DynamicContent } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
interface PartialDynamicContent
|
||||
extends Pick<DynamicContent, "dynamic_content"> {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { HotelListing } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface HotelListingProps {
|
||||
heading?: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Shortcut } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { Shortcut } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface ShortcutsListProps extends Shortcut {}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TableData } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { TableData } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface TableBlockProps {
|
||||
data: TableData
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import type { TextCols } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { TextCols } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface TextColProps extends Pick<TextCols, "text_cols"> {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UspGrid } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { UspGrid } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface UspGridProps extends Pick<UspGrid, "usp_grid"> {}
|
||||
export type UspIcon = UspGrid["usp_grid"]["usp_card"][number]["icon"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { HotelListingHotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
import { type HotelListingHotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
|
||||
import type { HotelListing } from "@/types/trpc/routers/contentstack/blocks"
|
||||
import type { HotelListing } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export interface HotelListingItemProps {
|
||||
hotelData: HotelListingHotelData
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { blocksSchema } from "@scandic-hotels/trpc/routers/contentstack/accountPage/output"
|
||||
import type { DynamicContent } from "@scandic-hotels/trpc/types/blocks"
|
||||
import type { Reward } from "@scandic-hotels/trpc/types/rewards"
|
||||
import type { Dispatch, SetStateAction } from "react"
|
||||
import type { z } from "zod"
|
||||
|
||||
import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
|
||||
|
||||
export interface AccountPageContentProps
|
||||
extends Pick<DynamicContent, "dynamic_content"> {}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { TeaserCard } from "@scandic-hotels/trpc/types/blocks"
|
||||
import type { ImageVaultAsset } from "@scandic-hotels/trpc/types/imageVault"
|
||||
import type { VariantProps } from "class-variance-authority"
|
||||
|
||||
import type { CardProps } from "@/components/TempDesignSystem/Card/card"
|
||||
import type { teaserCardVariants } from "@/components/TempDesignSystem/TeaserCard/variants"
|
||||
import type { TeaserCard } from "../trpc/routers/contentstack/blocks"
|
||||
|
||||
interface SidePeekButton {
|
||||
call_to_action_text: string
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import type { cardGallerySchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardGallery"
|
||||
import type { teaserCardBlockSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cards/teaserCard"
|
||||
import type { cardsGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardsGrid"
|
||||
import type { carouselCardsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/carouselCards"
|
||||
import type { contentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/content"
|
||||
import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/dynamicContent"
|
||||
import type { contentPageHotelListingSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/hotelListing"
|
||||
import type { shortcutsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/shortcuts"
|
||||
import type { tableSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/table"
|
||||
import type { textColsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/textCols"
|
||||
import type { uspGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/uspGrid"
|
||||
import type { z } from "zod"
|
||||
|
||||
export interface TeaserCard extends z.output<typeof teaserCardBlockSchema> {}
|
||||
export interface CardsGrid extends z.output<typeof cardsGridSchema> {}
|
||||
export interface Content extends z.output<typeof contentSchema> {}
|
||||
export interface DynamicContent extends z.output<typeof dynamicContentSchema> {}
|
||||
export interface Shortcuts extends z.output<typeof shortcutsSchema> {}
|
||||
export type Shortcut = Shortcuts["shortcuts"]
|
||||
export interface TableBlock extends z.output<typeof tableSchema> {}
|
||||
export type TableData = TableBlock["table"]
|
||||
export interface TextCols extends z.output<typeof textColsSchema> {}
|
||||
export interface UspGrid extends z.output<typeof uspGridSchema> {}
|
||||
interface GetHotelListing
|
||||
extends z.output<typeof contentPageHotelListingSchema> {}
|
||||
export type HotelListing = GetHotelListing["hotel_listing"]
|
||||
export interface CarouselCards extends z.output<typeof carouselCardsSchema> {}
|
||||
export interface CardGallery extends z.output<typeof cardGallerySchema> {}
|
||||
@@ -28,6 +28,9 @@ query GetCampaignPage($locale: String!, $uid: String!) {
|
||||
...Accordion_CampaignPage
|
||||
...HotelListing_CampaignPage
|
||||
}
|
||||
page_settings {
|
||||
booking_code
|
||||
}
|
||||
system {
|
||||
...System
|
||||
created_at
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
linkConnectionSchema,
|
||||
} from "../schemas/linkConnection"
|
||||
import { systemSchema } from "../schemas/system"
|
||||
import { getCarouselCardsBlockWithBookingCodeLinks } from "./utils"
|
||||
|
||||
const campaignPageEssentials = z
|
||||
.object({
|
||||
@@ -123,6 +124,11 @@ export const campaignPageSchema = z
|
||||
second_column: z.string(),
|
||||
}),
|
||||
blocks: discriminatedUnionArray(blocksSchema.options),
|
||||
page_settings: z
|
||||
.object({
|
||||
booking_code: z.string().nullish(),
|
||||
})
|
||||
.nullish(),
|
||||
system: systemSchema.merge(
|
||||
z.object({
|
||||
created_at: z.string(),
|
||||
@@ -134,27 +140,35 @@ export const campaignPageSchema = z
|
||||
url: z.string(),
|
||||
}),
|
||||
})
|
||||
.transform((data) => {
|
||||
const blocks = data.campaign_page.blocks.map((block) => {
|
||||
if (
|
||||
block.__typename === CampaignPageEnum.ContentStack.blocks.HotelListing
|
||||
) {
|
||||
return {
|
||||
...block,
|
||||
hotel_listing: {
|
||||
...block.hotel_listing,
|
||||
hotelIds: data.campaign_page.included_hotels,
|
||||
},
|
||||
}
|
||||
.transform(({ campaign_page, ...data }) => {
|
||||
const { blocks, page_settings, included_hotels, ...campaignPageData } =
|
||||
campaign_page
|
||||
const bookingCode = page_settings?.booking_code || null
|
||||
const mappedBlocks = blocks.map((block) => {
|
||||
switch (block.__typename) {
|
||||
case CampaignPageEnum.ContentStack.blocks.HotelListing:
|
||||
return {
|
||||
...block,
|
||||
hotel_listing: {
|
||||
...block.hotel_listing,
|
||||
hotelIds: included_hotels,
|
||||
bookingCode,
|
||||
},
|
||||
}
|
||||
case CampaignPageEnum.ContentStack.blocks.CarouselCards:
|
||||
return getCarouselCardsBlockWithBookingCodeLinks(block, bookingCode)
|
||||
case CampaignPageEnum.ContentStack.blocks.Essentials:
|
||||
case CampaignPageEnum.ContentStack.blocks.Accordion:
|
||||
default:
|
||||
return block
|
||||
}
|
||||
return block
|
||||
})
|
||||
|
||||
return {
|
||||
...data,
|
||||
campaign_page: {
|
||||
...data.campaign_page,
|
||||
blocks: [...blocks],
|
||||
...campaignPageData,
|
||||
blocks: [...mappedBlocks],
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { CampaignPageEnum } from "../../../types/campaignPage"
|
||||
import {
|
||||
CampaignPageEnum,
|
||||
type CampaignPageRefs,
|
||||
} from "../../../types/campaignPage"
|
||||
import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { CampaignPageRefs } from "../../../types/campaignPage"
|
||||
import type { CarouselCardsBlock } from "../../../types/campaignPage"
|
||||
import type { System } from "../schemas/system"
|
||||
|
||||
export function generatePageTags(
|
||||
@@ -43,3 +46,35 @@ export function getConnections({ campaign_page }: CampaignPageRefs) {
|
||||
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getCarouselCardsBlockWithBookingCodeLinks(
|
||||
block: CarouselCardsBlock,
|
||||
bookingCode: string | null
|
||||
): CarouselCardsBlock {
|
||||
if (!bookingCode) {
|
||||
return block
|
||||
}
|
||||
|
||||
const { link, cards, ...carousel_cards } = block.carousel_cards
|
||||
return {
|
||||
...block,
|
||||
carousel_cards: {
|
||||
...carousel_cards,
|
||||
link: link
|
||||
? {
|
||||
...link,
|
||||
href: `${link.href}?bookingCode=${bookingCode}`,
|
||||
}
|
||||
: undefined,
|
||||
cards: cards.map(({ link, ...card }) => ({
|
||||
...card,
|
||||
link: link
|
||||
? {
|
||||
...link,
|
||||
href: `${link.href}?bookingCode=${bookingCode}`,
|
||||
}
|
||||
: undefined,
|
||||
})),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
linkUnionSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import {
|
||||
contentCardRefSchema,
|
||||
contentCardSchema,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { scriptedCardThemeEnum } from "../../../../enums/scriptedCard"
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import {
|
||||
CardsGridEnum,
|
||||
CardsGridLayoutEnum,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import {
|
||||
contentCardRefSchema,
|
||||
contentCardSchema,
|
||||
@@ -66,6 +66,7 @@ const carouselCardGroupsNoFilterSchema = z
|
||||
.filter((card): card is NonNullable<typeof card> => card !== null)
|
||||
.map((card) => ({
|
||||
...card,
|
||||
filterId: "", // No filter for these cards
|
||||
}))
|
||||
return {
|
||||
cards,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { ContentEnum } from "../../../../types/content"
|
||||
import {
|
||||
accountPageSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { DynamicContentEnum } from "../../../../types/dynamicContent"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
|
||||
export const essentialsSchema = z.object({
|
||||
essentials: z.object({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import * as pageLinks from "../../../../routers/contentstack/schemas/pageLinks"
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { tempImageVaultAssetSchema } from "../imageVault"
|
||||
import { systemSchema } from "../system"
|
||||
import { buttonSchema } from "./utils/buttonLinkSchema"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { HotelPageEnum } from "../../../../types/hotelPageEnum"
|
||||
import {
|
||||
accordionItemsSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { Country } from "../../../../types/country"
|
||||
|
||||
export const locationFilterSchema = z
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { tempImageVaultAssetSchema } from "../imageVault"
|
||||
import { buttonSchema } from "./utils/buttonLinkSchema"
|
||||
import { linkConnectionRefsSchema } from "./utils/linkConnection"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
linkUnionSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
|
||||
export const tableSchema = z.object({
|
||||
typename: z
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { ContentEnum } from "../../../../types/content"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { sysAssetSchema } from "./sysAsset"
|
||||
|
||||
export const textContentSchema = z.object({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { BlocksEnums } from "../../../../types/blocks"
|
||||
import { BlocksEnums } from "../../../../types/blocksEnum"
|
||||
import { UspGridEnum } from "../../../../types/uspGrid"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
export namespace BlocksEnums {
|
||||
export const enum block {
|
||||
Accordion = "Accordion",
|
||||
CardGallery = "CardGallery",
|
||||
CardsGrid = "CardsGrid",
|
||||
CarouselCards = "CarouselCards",
|
||||
Content = "Content",
|
||||
DynamicContent = "DynamicContent",
|
||||
FullWidthCampaign = "FullWidthCampaign",
|
||||
CampaignOverviewPageHotelListing = "CampaignOverviewPageHotelListing",
|
||||
CampaignPageHotelListing = "CampaignPageHotelListing",
|
||||
ContentPageHotelListing = "ContentPageHotelListing",
|
||||
JoinScandicFriends = "JoinScandicFriends",
|
||||
Shortcuts = "Shortcuts",
|
||||
Table = "Table",
|
||||
TextCols = "TextCols",
|
||||
TextContent = "TextContent",
|
||||
UspGrid = "UspGrid",
|
||||
Essentials = "Essentials",
|
||||
}
|
||||
}
|
||||
import type { cardGallerySchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardGallery"
|
||||
import type { teaserCardBlockSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cards/teaserCard"
|
||||
import type { cardsGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/cardsGrid"
|
||||
import type { carouselCardsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/carouselCards"
|
||||
import type { contentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/content"
|
||||
import type { dynamicContentSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/dynamicContent"
|
||||
import type { contentPageHotelListingSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/hotelListing"
|
||||
import type { shortcutsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/shortcuts"
|
||||
import type { tableSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/table"
|
||||
import type { textColsSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/textCols"
|
||||
import type { uspGridSchema } from "@scandic-hotels/trpc/routers/contentstack/schemas/blocks/uspGrid"
|
||||
import type { z } from "zod"
|
||||
|
||||
export interface TeaserCard extends z.output<typeof teaserCardBlockSchema> {}
|
||||
export interface CardsGrid extends z.output<typeof cardsGridSchema> {}
|
||||
export interface Content extends z.output<typeof contentSchema> {}
|
||||
export interface DynamicContent extends z.output<typeof dynamicContentSchema> {}
|
||||
export interface Shortcuts extends z.output<typeof shortcutsSchema> {}
|
||||
export type Shortcut = Shortcuts["shortcuts"]
|
||||
export interface TableBlock extends z.output<typeof tableSchema> {}
|
||||
export type TableData = TableBlock["table"]
|
||||
export interface TextCols extends z.output<typeof textColsSchema> {}
|
||||
export interface UspGrid extends z.output<typeof uspGridSchema> {}
|
||||
interface GetHotelListing
|
||||
extends z.output<typeof contentPageHotelListingSchema> {}
|
||||
export type HotelListing = GetHotelListing["hotel_listing"]
|
||||
export interface CarouselCards extends z.output<typeof carouselCardsSchema> {}
|
||||
export interface CardGallery extends z.output<typeof cardGallerySchema> {}
|
||||
|
||||
21
packages/trpc/lib/types/blocksEnum.ts
Normal file
21
packages/trpc/lib/types/blocksEnum.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export namespace BlocksEnums {
|
||||
export const enum block {
|
||||
Accordion = "Accordion",
|
||||
CardGallery = "CardGallery",
|
||||
CardsGrid = "CardsGrid",
|
||||
CarouselCards = "CarouselCards",
|
||||
Content = "Content",
|
||||
DynamicContent = "DynamicContent",
|
||||
FullWidthCampaign = "FullWidthCampaign",
|
||||
CampaignOverviewPageHotelListing = "CampaignOverviewPageHotelListing",
|
||||
CampaignPageHotelListing = "CampaignPageHotelListing",
|
||||
ContentPageHotelListing = "ContentPageHotelListing",
|
||||
JoinScandicFriends = "JoinScandicFriends",
|
||||
Shortcuts = "Shortcuts",
|
||||
Table = "Table",
|
||||
TextCols = "TextCols",
|
||||
TextContent = "TextContent",
|
||||
UspGrid = "UspGrid",
|
||||
Essentials = "Essentials",
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
campaignPageSchema,
|
||||
heroSchema,
|
||||
} from "../routers/contentstack/campaignPage/output"
|
||||
import type { carouselCardsSchema } from "../routers/contentstack/schemas/blocks/carouselCards"
|
||||
import type { essentialsSchema } from "../routers/contentstack/schemas/blocks/essentials"
|
||||
|
||||
export namespace CampaignPageEnum {
|
||||
@@ -31,6 +32,8 @@ export interface CampaignPageRefs
|
||||
|
||||
export type Block = CampaignPageData["blocks"][number]
|
||||
|
||||
export interface CarouselCardsBlock
|
||||
extends z.output<typeof carouselCardsSchema> {}
|
||||
export type EssentialsBlock = z.output<typeof essentialsSchema>["essentials"]
|
||||
|
||||
export type Hero = z.output<typeof heroSchema>
|
||||
|
||||
Reference in New Issue
Block a user