diff --git a/components/MyPages/AccountPage/Content.tsx b/components/MyPages/AccountPage/Content.tsx
index 1abf7568f..8f15ef5a7 100644
--- a/components/MyPages/AccountPage/Content.tsx
+++ b/components/MyPages/AccountPage/Content.tsx
@@ -44,8 +44,10 @@ export default function Content({ lang, content }: ContentProps) {
case ContentEntries.AccountPageContentDynamicContent:
const link = item.dynamic_content.link.linkConnection.edges.length
? {
- href: item.dynamic_content.link.linkConnection.edges[0].node
- .url,
+ href:
+ item.dynamic_content.link.linkConnection.edges[0].node
+ .original_url ||
+ `/${lang}${item.dynamic_content.link.linkConnection.edges[0].node.url}`,
text: item.dynamic_content.link.link_text,
}
: null
@@ -64,16 +66,9 @@ export default function Content({ lang, content }: ContentProps) {
/>
)
case ContentEntries.AccountPageContentShortcuts:
- const shortcuts = item.shortcuts.shortcuts.map((shortcut) => {
- return {
- text: shortcut.text,
- openInNewTab: shortcut.open_in_new_tab,
- ...shortcut.linkConnection.edges[0].node,
- }
- })
return (
diff --git a/server/routers/contentstack/accountPage/output.ts b/server/routers/contentstack/accountPage/output.ts
index b8ad5d7e3..316c7d07a 100644
--- a/server/routers/contentstack/accountPage/output.ts
+++ b/server/routers/contentstack/accountPage/output.ts
@@ -25,6 +25,7 @@ const accountPageShortcuts = z.object({
uid: z.string(),
locale: z.nativeEnum(Lang),
}),
+ original_url: z.string().optional(),
url: z.string(),
title: z.string(),
}),
@@ -55,6 +56,7 @@ const accountPageDynamicContent = z.object({
locale: z.nativeEnum(Lang),
}),
url: z.string(),
+ original_url: z.string().optional(),
title: z.string(),
}),
})
@@ -86,6 +88,17 @@ type DynamicContentRaw = z.infer
type ShortcutsRaw = z.infer
+export type Shortcuts = Omit & {
+ shortcuts: Omit & {
+ shortcuts: {
+ text?: string
+ openInNewTab: boolean
+ url: string
+ title: string
+ }[]
+ }
+}
+
export type RteTextContent = Omit & {
text_content: {
content: {
@@ -97,7 +110,7 @@ export type RteTextContent = Omit & {
export type AccountPageContentItem =
| DynamicContentRaw
- | ShortcutsRaw
+ | Shortcuts
| RteTextContent
const accountPageContentItem = z.discriminatedUnion("__typename", [
diff --git a/server/routers/contentstack/accountPage/query.ts b/server/routers/contentstack/accountPage/query.ts
index 711c11f1b..e37515843 100644
--- a/server/routers/contentstack/accountPage/query.ts
+++ b/server/routers/contentstack/accountPage/query.ts
@@ -36,8 +36,22 @@ export const accountPageQueryRouter = router({
(block) => {
switch (block.__typename) {
case ContentEntries.AccountPageContentDynamicContent:
- case ContentEntries.AccountPageContentShortcuts:
return block
+ case ContentEntries.AccountPageContentShortcuts:
+ return {
+ ...block,
+ shortcuts: {
+ ...block.shortcuts,
+ shortcuts: block.shortcuts.shortcuts.map((shortcut) => ({
+ text: shortcut.text,
+ openInNewTab: shortcut.open_in_new_tab,
+ ...shortcut.linkConnection.edges[0].node,
+ url:
+ shortcut.linkConnection.edges[0].node.original_url ||
+ `/${shortcut.linkConnection.edges[0].node.system.locale}${shortcut.linkConnection.edges[0].node.url}`,
+ })),
+ },
+ }
case ContentEntries.AccountPageContentTextContent:
return {
...block,
diff --git a/server/routers/contentstack/loyaltyPage/output.ts b/server/routers/contentstack/loyaltyPage/output.ts
index 1b37b84d4..5b55b4fd6 100644
--- a/server/routers/contentstack/loyaltyPage/output.ts
+++ b/server/routers/contentstack/loyaltyPage/output.ts
@@ -88,7 +88,7 @@ const loyaltyPageShortcuts = z.object({
url: z.string(),
web: z
.object({
- original_url: z.string(),
+ original_url: z.string().optional(),
})
.optional(),
title: z.string(),