chore: organize types

This commit is contained in:
Arvid Norlin
2024-05-02 10:52:05 +02:00
parent ec37ee0f1f
commit 58d2963d6a
6 changed files with 25 additions and 87 deletions

View File

@@ -1,74 +0,0 @@
import { Embeds } from "../embeds"
import { AllRequestResponse } from "../utils/all"
import { PageLink } from "../utils/pageLink"
import { RTEDocument } from "@/types/rte/node"
import type { Edges } from "../utils/edges"
import type { Typename } from "../utils/typename"
export enum DynamicContentComponents {
membership_overview = "membership_overview",
soonest_stays = "soonest_stays",
previous_stays = "previous_stays",
upcoming_stays = "upcoming_stays",
current_benefits = "current_benefits",
next_benefits = "next_benefits",
}
export enum ContentEntries {
AccountPageContentDynamicContent = "AccountPageContentDynamicContent",
AccountPageContentShortcuts = "AccountPageContentShortcuts",
AccountPageContentTextContent = "AccountPageContentTextContent",
}
type Shortcut = {
linkConnection: Edges<PageLink>
open_in_new_tab: boolean
text?: string
}
type DynamicContent = {
component: DynamicContentComponents
title?: string
preamble?: string
link: { linkConnection: Edges<PageLink>; link_text: string }
}
type AccountPageDynamicContent = Typename<
{ dynamic_content: DynamicContent },
ContentEntries.AccountPageContentDynamicContent
>
type AccountPageContentShortcuts = Typename<
{
shortcuts: { title?: string; preamble?: string; shortcuts: Shortcut[] }
},
ContentEntries.AccountPageContentShortcuts
>
type AccountPageContentTextContent = Typename<
{
text_content: {
content: {
json: RTEDocument
embedded_itemsConnection: Edges<Embeds>
}
}
},
ContentEntries.AccountPageContentTextContent
>
export type AccountPageContentItem =
| AccountPageDynamicContent
| AccountPageContentShortcuts
| AccountPageContentTextContent
type AccountPage = {
url: string
title: string
content: AccountPageContentItem[]
}
export type GetAccountPageData = {
all_account_page: AllRequestResponse<AccountPage>
}