fix: typings for contactConfig

This commit is contained in:
Christel Westerberg
2024-04-18 11:44:52 +02:00
parent c00f7b78eb
commit b57665ce62
4 changed files with 106 additions and 38 deletions
+33 -30
View File
@@ -1,19 +1,48 @@
import { PageLink } from "./myPages/navigation"
import type { AllRequestResponse } from "./utils/all"
import type { Typename } from "./utils/typename"
import { Edges } from "./utils/edges"
import type { RTEDocument } from "../rte/node"
import type { Embeds } from "./embeds"
import type { ContactField } from "./contactConfig"
enum SidebarTypenameEnum {
LoyaltyPageSidebarLoyaltyJoinContact = "LoyaltyPageSidebarLoyaltyJoinContact",
LoyaltyPageSidebarContent = "LoyaltyPageSidebarContent",
}
type SidebarContent = {}
type SidebarContent = {
content: {
embedded_itemsConnection: Edges<Embeds>
json: RTEDocument
}
}
type JoinContact = {}
type Contact = {
contact: {
contact_fields: ContactField[]
}
}
type LoyaltyJoinContact = {
loyalty_join_contact: {
title: string
contact: Typename<
Contact,
"LoyaltyPageSidebarLoyaltyJoinContactBlockContactContact"
>
login_button_text: string
body: {
embedded_itemsConnection: Edges<Embeds>
json: RTEDocument
}
}
}
export type Sidebar =
| Typename<SidebarContent, SidebarTypenameEnum.LoyaltyPageSidebarContent>
| Typename<
JoinContact,
LoyaltyJoinContact,
SidebarTypenameEnum.LoyaltyPageSidebarLoyaltyJoinContact
>
@@ -22,38 +51,12 @@ enum ContentBlocks {
LoyaltyPageContentCardGrid = "LoyaltyPageContentCardGrid",
}
enum LinkedPageConnection {
LoyaltyPage = "LoyaltyPage",
ContentPage = "ContentPage",
AccountPage = "AccountPage",
}
type ContentPageLink = {
web: { url: string }
}
type LoyaltyPageLink = {
url: string
}
type AccountPageLink = {
url: string
}
type LinkedPage =
| Typename<ContentPageLink, LinkedPageConnection.ContentPage>
| Typename<LoyaltyPageLink, ContentBlocks.LoyaltyPageContentLoyaltyLevels>
| Typename<AccountPageLink, ContentBlocks.LoyaltyPageContentLoyaltyLevels>
type CardGrid = {
card_grid: {
heading: string
subheading: string
cards: {
referenceConnection: {
edges: {
node: LinkedPage
}
}
referenceConnection: Edges<PageLink>
heading: string
subheading: string
}