diff --git a/components/Content/Blocks/index.tsx b/components/Content/Blocks/index.tsx
index 8268aad0a..3638d7af6 100644
--- a/components/Content/Blocks/index.tsx
+++ b/components/Content/Blocks/index.tsx
@@ -1,7 +1,7 @@
import JsonToHtml from "@/components/JsonToHtml"
-
// import DynamicContentBlock from "@/components/Loyalty/Blocks/DynamicContent"
-// import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
+import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
+
// import CardsGrid from "./CardsGrid"
import type { BlocksProps } from "@/types/components/content/blocks"
import { ContentBlocksTypenameEnum } from "@/types/components/content/enums"
@@ -19,6 +19,16 @@ export function Blocks({ blocks }: BlocksProps) {
/>
)
+ case ContentBlocksTypenameEnum.ContentPageBlocksShortcuts:
+ return (
+
+ )
default:
return null
}
diff --git a/lib/graphql/Query/ContentPage.graphql b/lib/graphql/Query/ContentPage.graphql
index 5fc625fa3..47db78954 100644
--- a/lib/graphql/Query/ContentPage.graphql
+++ b/lib/graphql/Query/ContentPage.graphql
@@ -34,6 +34,27 @@ query GetContentPage($locale: String!, $uid: String!) {
}
}
}
+ ... on ContentPageBlocksShortcuts {
+ __typename
+ shortcuts {
+ title
+ preamble
+ shortcuts {
+ open_in_new_tab
+ text
+ linkConnection {
+ totalCount
+ edges {
+ node {
+ ...LoyaltyPageLink
+ ...ContentPageLink
+ ...AccountPageLink
+ }
+ }
+ }
+ }
+ }
+ }
}
title
header {
diff --git a/server/routers/contentstack/contentPage/output.ts b/server/routers/contentstack/contentPage/output.ts
index 6965b3187..8b3f6a0ea 100644
--- a/server/routers/contentstack/contentPage/output.ts
+++ b/server/routers/contentstack/contentPage/output.ts
@@ -24,8 +24,25 @@ const contentPageBlockTextContent = z.object({
}),
})
+const contentPageShortcuts = z.object({
+ __typename: z.literal(ContentBlocksTypenameEnum.ContentPageBlocksShortcuts),
+ shortcuts: z.object({
+ title: z.string().nullable(),
+ preamble: z.string().nullable(),
+ shortcuts: z.array(
+ z.object({
+ text: z.string().optional(),
+ openInNewTab: z.boolean(),
+ url: z.string(),
+ title: z.string(),
+ })
+ ),
+ }),
+})
+
const contentPageBlockItem = z.discriminatedUnion("__typename", [
contentPageBlockTextContent,
+ contentPageShortcuts,
])
type BlockContentRaw = z.infer
@@ -38,7 +55,8 @@ export interface RteBlockContent extends BlockContentRaw {
}
}
-export type Block = RteBlockContent
+export type Shortcuts = z.infer
+export type Block = RteBlockContent | Shortcuts
// Content Page Schema and types
export const validateContentPageSchema = z.object({
diff --git a/server/routers/contentstack/contentPage/query.ts b/server/routers/contentstack/contentPage/query.ts
index 35d864fd5..e1215d38b 100644
--- a/server/routers/contentstack/contentPage/query.ts
+++ b/server/routers/contentstack/contentPage/query.ts
@@ -6,6 +6,7 @@ import { contentstackExtendedProcedureUID, router } from "@/server/trpc"
import { generateTag } from "@/utils/generateTag"
import { makeImageVaultImage } from "@/utils/imageVault"
+import { removeMultipleSlashes } from "@/utils/url"
import { removeEmptyObjects } from "../../utils"
import {
@@ -44,6 +45,23 @@ export const contentPageQueryRouter = router({
switch (block.__typename) {
case ContentBlocksTypenameEnum.ContentPageBlocksContent:
return block
+ case ContentBlocksTypenameEnum.ContentPageBlocksShortcuts:
+ return {
+ ...block,
+ shortcuts: {
+ ...block.shortcuts,
+ shortcuts: block.shortcuts.shortcuts.map((shortcut: any) => ({
+ text: shortcut.text,
+ openInNewTab: shortcut.open_in_new_tab,
+ ...shortcut.linkConnection.edges[0].node,
+ url:
+ shortcut.linkConnection.edges[0].node.web?.original_url ||
+ removeMultipleSlashes(
+ `/${shortcut.linkConnection.edges[0].node.system.locale}/${shortcut.linkConnection.edges[0].node.url}`
+ ),
+ })),
+ },
+ }
default:
return block
}
diff --git a/types/components/content/enums.ts b/types/components/content/enums.ts
index 3fa911d6b..77fad4d68 100644
--- a/types/components/content/enums.ts
+++ b/types/components/content/enums.ts
@@ -1,3 +1,4 @@
export enum ContentBlocksTypenameEnum {
ContentPageBlocksContent = "ContentPageBlocksContent",
+ ContentPageBlocksShortcuts = "ContentPageBlocksShortcuts",
}