From 2b5573059ca0cb0b161db84aea7effa75d9193c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matilda=20Landstr=C3=B6m?= Date: Fri, 27 Jun 2025 13:27:35 +0000 Subject: [PATCH] Merged in fix/teaser-card-issue (pull request #2459) fix(SW-3120): update teaser card validation * fix: update teaser card validation Approved-by: Michael Zetterberg Approved-by: Linus Flood --- .../TeaserCard/Sidepeek/index.tsx | 10 +-- .../schemas/blocks/cards/teaserCard.ts | 62 ++++++++++--------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/apps/scandic-web/components/TempDesignSystem/TeaserCard/Sidepeek/index.tsx b/apps/scandic-web/components/TempDesignSystem/TeaserCard/Sidepeek/index.tsx index 034a3540d..53d5a1320 100644 --- a/apps/scandic-web/components/TempDesignSystem/TeaserCard/Sidepeek/index.tsx +++ b/apps/scandic-web/components/TempDesignSystem/TeaserCard/Sidepeek/index.tsx @@ -39,10 +39,12 @@ export default function TeaserCardSidepeek({ handleClose={() => setSidePeekIsOpen(false)} openInRoot > - + {content ? ( + + ) : null}
{primary_button && ( { - const link = transformPageLink(data) - if (link) { - return link - } - return data - }), - }) - ), - }), - }), + content: z + .object({ + json: z.any(), + embedded_itemsConnection: z.object({ + edges: z.array( + z.object({ + node: z + .discriminatedUnion("__typename", [ + imageContainerSchema, + sysAssetSchema, + accountPageSchema, + collectionPageSchema, + contentPageSchema, + destinationCityPageSchema, + destinationCountryPageSchema, + destinationOverviewPageSchema, + hotelPageSchema, + loyaltyPageSchema, + startPageSchema, + ]) + .transform((data) => { + const link = transformPageLink(data) + if (link) { + return link + } + return data + }), + }) + ), + }), + }) + .nullish(), has_primary_button: z.boolean().default(false), primary_button: buttonSchema, has_secondary_button: z.boolean().default(false),