feat(SW-322): change output variable name
This commit is contained in:
@@ -9,50 +9,57 @@ export const shortcutsSchema = z.object({
|
||||
.literal(BlocksEnums.block.Shortcuts)
|
||||
.optional()
|
||||
.default(BlocksEnums.block.Shortcuts),
|
||||
shortcuts: z.object({
|
||||
subtitle: z.string().nullable(),
|
||||
title: z.string().nullable(),
|
||||
columns: z.boolean().default(false),
|
||||
shortcuts: z
|
||||
.array(
|
||||
z.object({
|
||||
open_in_new_tab: z.boolean(),
|
||||
text: z.string().optional().default(""),
|
||||
linkConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z
|
||||
.discriminatedUnion("__typename", [
|
||||
pageLinks.accountPageSchema,
|
||||
pageLinks.contentPageSchema,
|
||||
pageLinks.loyaltyPageSchema,
|
||||
])
|
||||
.transform((data) => {
|
||||
const link = pageLinks.transform(data)
|
||||
if (link) {
|
||||
return link
|
||||
}
|
||||
return data
|
||||
}),
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
)
|
||||
.transform((data) => {
|
||||
return data
|
||||
.filter((node) => node.linkConnection.edges.length)
|
||||
.map((node) => {
|
||||
const link = node.linkConnection.edges[0].node
|
||||
return {
|
||||
openInNewTab: node.open_in_new_tab,
|
||||
text: node.text,
|
||||
title: link.title,
|
||||
url: link.url,
|
||||
}
|
||||
shortcuts: z
|
||||
.object({
|
||||
subtitle: z.string().nullable(),
|
||||
title: z.string().nullable(),
|
||||
two_column_list: z.boolean().default(false),
|
||||
shortcuts: z
|
||||
.array(
|
||||
z.object({
|
||||
open_in_new_tab: z.boolean(),
|
||||
text: z.string().optional().default(""),
|
||||
linkConnection: z.object({
|
||||
edges: z.array(
|
||||
z.object({
|
||||
node: z
|
||||
.discriminatedUnion("__typename", [
|
||||
pageLinks.accountPageSchema,
|
||||
pageLinks.contentPageSchema,
|
||||
pageLinks.loyaltyPageSchema,
|
||||
])
|
||||
.transform((data) => {
|
||||
const link = pageLinks.transform(data)
|
||||
if (link) {
|
||||
return link
|
||||
}
|
||||
return data
|
||||
}),
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
}),
|
||||
}),
|
||||
)
|
||||
.transform((data) => {
|
||||
return data
|
||||
.filter((node) => node.linkConnection.edges.length)
|
||||
.map((node) => {
|
||||
const link = node.linkConnection.edges[0].node
|
||||
return {
|
||||
openInNewTab: node.open_in_new_tab,
|
||||
text: node.text,
|
||||
title: link.title,
|
||||
url: link.url,
|
||||
}
|
||||
})
|
||||
}),
|
||||
})
|
||||
.transform(({ two_column_list, ...rest }) => {
|
||||
return {
|
||||
...rest,
|
||||
twoColumnList: two_column_list,
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
export const shortcutsRefsSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user