diff --git a/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx b/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx index eb2908972..47b371ced 100644 --- a/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx +++ b/apps/scandic-web/components/Blocks/CampaignHotelListing/Client.tsx @@ -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} {showButton ? ( diff --git a/apps/scandic-web/components/Blocks/CampaignHotelListing/index.tsx b/apps/scandic-web/components/Blocks/CampaignHotelListing/index.tsx index 8f0277077..819b9eb19 100644 --- a/apps/scandic-web/components/Blocks/CampaignHotelListing/index.tsx +++ b/apps/scandic-web/components/Blocks/CampaignHotelListing/index.tsx @@ -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({ { @@ -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} /> ) diff --git a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx index 2a0ec1234..877fdfacd 100644 --- a/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx +++ b/apps/scandic-web/components/ContentType/DestinationPage/Blocks/index.tsx @@ -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" diff --git a/apps/scandic-web/components/ContentType/StartPage/index.tsx b/apps/scandic-web/components/ContentType/StartPage/index.tsx index 5b375f696..e5c60fe98 100644 --- a/apps/scandic-web/components/ContentType/StartPage/index.tsx +++ b/apps/scandic-web/components/ContentType/StartPage/index.tsx @@ -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" diff --git a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx index 3885a5712..45fbbe032 100644 --- a/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/AccountPage/Blocks.tsx @@ -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" diff --git a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx index 2400cb3b8..7e38aa838 100644 --- a/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx +++ b/apps/scandic-web/components/Webviews/LoyaltyPage/Blocks.tsx @@ -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() diff --git a/apps/scandic-web/types/components/blocks/cardGallery.ts b/apps/scandic-web/types/components/blocks/cardGallery.ts index 9733c443d..f9c10b941 100644 --- a/apps/scandic-web/types/components/blocks/cardGallery.ts +++ b/apps/scandic-web/types/components/blocks/cardGallery.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/cardsGrid.ts b/apps/scandic-web/types/components/blocks/cardsGrid.ts index 8bdd4451d..705c087fb 100644 --- a/apps/scandic-web/types/components/blocks/cardsGrid.ts +++ b/apps/scandic-web/types/components/blocks/cardsGrid.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/carouselCards.ts b/apps/scandic-web/types/components/blocks/carouselCards.ts index 934f38096..a90c55411 100644 --- a/apps/scandic-web/types/components/blocks/carouselCards.ts +++ b/apps/scandic-web/types/components/blocks/carouselCards.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/dynamicContent.ts b/apps/scandic-web/types/components/blocks/dynamicContent.ts index 1c67f0512..a57a9c47f 100644 --- a/apps/scandic-web/types/components/blocks/dynamicContent.ts +++ b/apps/scandic-web/types/components/blocks/dynamicContent.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/hotelListing.ts b/apps/scandic-web/types/components/blocks/hotelListing.ts index 6505ac184..d35e6a5b7 100644 --- a/apps/scandic-web/types/components/blocks/hotelListing.ts +++ b/apps/scandic-web/types/components/blocks/hotelListing.ts @@ -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 diff --git a/apps/scandic-web/types/components/blocks/shortcuts.ts b/apps/scandic-web/types/components/blocks/shortcuts.ts index 75d2762fc..0ccc890d0 100644 --- a/apps/scandic-web/types/components/blocks/shortcuts.ts +++ b/apps/scandic-web/types/components/blocks/shortcuts.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/table.ts b/apps/scandic-web/types/components/blocks/table.ts index 9438f7d43..362223c01 100644 --- a/apps/scandic-web/types/components/blocks/table.ts +++ b/apps/scandic-web/types/components/blocks/table.ts @@ -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 diff --git a/apps/scandic-web/types/components/blocks/textCols.ts b/apps/scandic-web/types/components/blocks/textCols.ts index a4ec3ff6c..6698217c1 100644 --- a/apps/scandic-web/types/components/blocks/textCols.ts +++ b/apps/scandic-web/types/components/blocks/textCols.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/blocks/uspGrid.ts b/apps/scandic-web/types/components/blocks/uspGrid.ts index ea6218541..4db708283 100644 --- a/apps/scandic-web/types/components/blocks/uspGrid.ts +++ b/apps/scandic-web/types/components/blocks/uspGrid.ts @@ -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 {} export type UspIcon = UspGrid["usp_grid"]["usp_card"][number]["icon"] diff --git a/apps/scandic-web/types/components/contentPage/hotelListingItem.ts b/apps/scandic-web/types/components/contentPage/hotelListingItem.ts index 28a476111..35ecb7ee4 100644 --- a/apps/scandic-web/types/components/contentPage/hotelListingItem.ts +++ b/apps/scandic-web/types/components/contentPage/hotelListingItem.ts @@ -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 diff --git a/apps/scandic-web/types/components/myPages/myPage/accountPage.ts b/apps/scandic-web/types/components/myPages/myPage/accountPage.ts index be6e8ecca..26417c426 100644 --- a/apps/scandic-web/types/components/myPages/myPage/accountPage.ts +++ b/apps/scandic-web/types/components/myPages/myPage/accountPage.ts @@ -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 {} diff --git a/apps/scandic-web/types/components/teaserCard.ts b/apps/scandic-web/types/components/teaserCard.ts index a209db057..eba3ae7b5 100644 --- a/apps/scandic-web/types/components/teaserCard.ts +++ b/apps/scandic-web/types/components/teaserCard.ts @@ -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 diff --git a/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts b/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts deleted file mode 100644 index 93eadb3db..000000000 --- a/apps/scandic-web/types/trpc/routers/contentstack/blocks.ts +++ /dev/null @@ -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 {} -export interface CardsGrid extends z.output {} -export interface Content extends z.output {} -export interface DynamicContent extends z.output {} -export interface Shortcuts extends z.output {} -export type Shortcut = Shortcuts["shortcuts"] -export interface TableBlock extends z.output {} -export type TableData = TableBlock["table"] -export interface TextCols extends z.output {} -export interface UspGrid extends z.output {} -interface GetHotelListing - extends z.output {} -export type HotelListing = GetHotelListing["hotel_listing"] -export interface CarouselCards extends z.output {} -export interface CardGallery extends z.output {} diff --git a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql index 1ee76426f..c4a6a8e87 100644 --- a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql +++ b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql @@ -28,6 +28,9 @@ query GetCampaignPage($locale: String!, $uid: String!) { ...Accordion_CampaignPage ...HotelListing_CampaignPage } + page_settings { + booking_code + } system { ...System created_at diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/output.ts b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts index 2f47d48ac..4892b860d 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts @@ -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], }, } }) diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts index da006cd7a..5d6f3137a 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts @@ -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, + })), + }, + } +} diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts index 8cd02a101..2a3f501ba 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { BlocksEnums } from "../../../../types/blocks" +import { BlocksEnums } from "../../../../types/blocksEnum" import { linkRefsUnionSchema, linkUnionSchema, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts index dcfe98e1b..306951a2f 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { BlocksEnums } from "../../../../types/blocks" +import { BlocksEnums } from "../../../../types/blocksEnum" import { contentCardRefSchema, contentCardSchema, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts index ae0c7cb83..8422ba1c0 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts @@ -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, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts index 23dae869b..806513921 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts @@ -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 => card !== null) .map((card) => ({ ...card, + filterId: "", // No filter for these cards })) return { cards, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts index 674c1be9a..7338802ab 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts @@ -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, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts index efe28e6f1..10332fe5d 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts @@ -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, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts index b4e4e179a..9a349f7a7 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/essentials.ts @@ -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({ diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts index a45fb5a60..c1c8f8660 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts @@ -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" diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts index 6c2ddb4bb..8fea237ef 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts @@ -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, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts index e6d1b7539..5c2f7e013 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelListing.ts @@ -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 diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts index 132ccbc7a..ef73310e8 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts @@ -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" diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts index 4f8b09d22..db0797688 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts @@ -1,6 +1,6 @@ import { z } from "zod" -import { BlocksEnums } from "../../../../types/blocks" +import { BlocksEnums } from "../../../../types/blocksEnum" import { linkRefsUnionSchema, linkUnionSchema, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts index 56eaeeb2d..de256fed8 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/table.ts @@ -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 diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts index 3ac1925e9..030ef06e2 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts @@ -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, diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts index 92e17299b..faa4e8217 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/textContent.ts @@ -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({ diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts index 0166325ef..6258f73cc 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts @@ -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, diff --git a/packages/trpc/lib/types/blocks.ts b/packages/trpc/lib/types/blocks.ts index 5807dbb06..93eadb3db 100644 --- a/packages/trpc/lib/types/blocks.ts +++ b/packages/trpc/lib/types/blocks.ts @@ -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 {} +export interface CardsGrid extends z.output {} +export interface Content extends z.output {} +export interface DynamicContent extends z.output {} +export interface Shortcuts extends z.output {} +export type Shortcut = Shortcuts["shortcuts"] +export interface TableBlock extends z.output {} +export type TableData = TableBlock["table"] +export interface TextCols extends z.output {} +export interface UspGrid extends z.output {} +interface GetHotelListing + extends z.output {} +export type HotelListing = GetHotelListing["hotel_listing"] +export interface CarouselCards extends z.output {} +export interface CardGallery extends z.output {} diff --git a/packages/trpc/lib/types/blocksEnum.ts b/packages/trpc/lib/types/blocksEnum.ts new file mode 100644 index 000000000..5807dbb06 --- /dev/null +++ b/packages/trpc/lib/types/blocksEnum.ts @@ -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", + } +} diff --git a/packages/trpc/lib/types/campaignPage.ts b/packages/trpc/lib/types/campaignPage.ts index 102dd2fde..2ad2a492f 100644 --- a/packages/trpc/lib/types/campaignPage.ts +++ b/packages/trpc/lib/types/campaignPage.ts @@ -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 {} export type EssentialsBlock = z.output["essentials"] export type Hero = z.output