feat(WEB-209): revalidate my pages navigation on demand
This commit is contained in:
committed by
Michael Zetterberg
parent
16634abbbf
commit
1bffbc837e
@@ -1,5 +1,5 @@
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { EdgesWithTotalCount } from "../utils/edges"
|
||||
import type { Typename } from "../utils/typename"
|
||||
|
||||
export enum Section {
|
||||
@@ -75,6 +75,6 @@ export type ContactNode = {
|
||||
|
||||
export type Contact = {
|
||||
contact: {
|
||||
contactConnection: Edges<ContactNode>
|
||||
contactConnection: EdgesWithTotalCount<ContactNode>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { Embeds } from "../embeds"
|
||||
import type { RTEDocument } from "@/types/rte/node"
|
||||
import type { Embeds } from "../embeds"
|
||||
import type { EdgesWithTotalCount } from "../utils/edges"
|
||||
|
||||
export type Text = {
|
||||
text: {
|
||||
content: {
|
||||
embedded_itemsConnection: Edges<Embeds>
|
||||
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
|
||||
json: RTEDocument
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,8 @@ import type { List } from "./blocks/list"
|
||||
import type { PuffBlock } from "./blocks/puff"
|
||||
import type { Preamble } from "./preamble"
|
||||
import type { Text } from "./blocks/text"
|
||||
import type { AllRequestResponse } from "./utils/all"
|
||||
import type {
|
||||
AsideTypenameEnum,
|
||||
Typename,
|
||||
} from "./utils/typename"
|
||||
import type { AllRequestResponseWithTotal } from "./utils/all"
|
||||
import type { AsideTypenameEnum, Typename } from "./utils/typename"
|
||||
|
||||
export type Asides =
|
||||
| Typename<Contact, AsideTypenameEnum.CurrentBlocksPageAsideContact>
|
||||
@@ -48,5 +45,5 @@ export type BlockPage = {
|
||||
}
|
||||
|
||||
export type GetCurrentBlockPageData = {
|
||||
all_current_blocks_page: AllRequestResponse<BlockPage>
|
||||
all_current_blocks_page: AllRequestResponseWithTotal<BlockPage>
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { AllRequestResponse } from "./utils/all"
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { Image } from "../image"
|
||||
import type { AllRequestResponse } from "./utils/all"
|
||||
import type { EdgesWithTotalCount } from "./utils/edges"
|
||||
|
||||
type AppDownload = {
|
||||
href: string
|
||||
imageConnection: Edges<Image>
|
||||
imageConnection: EdgesWithTotalCount<Image>
|
||||
}
|
||||
|
||||
export type Link = {
|
||||
@@ -33,7 +33,7 @@ export type Footer = {
|
||||
app_store: AppDownload
|
||||
google_play: AppDownload
|
||||
}
|
||||
logoConnection: Edges<Image>
|
||||
logoConnection: EdgesWithTotalCount<Image>
|
||||
navigation: NavigationItem[]
|
||||
social_media: {
|
||||
title: string
|
||||
@@ -43,7 +43,7 @@ export type Footer = {
|
||||
}
|
||||
trip_advisor: {
|
||||
title: string
|
||||
logoConnection: Edges<Image>
|
||||
logoConnection: EdgesWithTotalCount<Image>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { Image } from "../image"
|
||||
import type { EdgesWithTotalCount } from "./utils/edges"
|
||||
|
||||
export type HeaderLink = {
|
||||
href: string
|
||||
@@ -27,7 +27,7 @@ export type HeaderQueryData = {
|
||||
all_header: {
|
||||
items: {
|
||||
frontpage_link_text: string
|
||||
logoConnection: Edges<Image>
|
||||
logoConnection: EdgesWithTotalCount<Image>
|
||||
menu: HeaderLinks
|
||||
top_menu: TopMenuHeaderLinks
|
||||
}[]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Image } from "../image"
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { EdgesWithTotalCount } from "./utils/edges"
|
||||
|
||||
export type Hero = {
|
||||
imagesConnection: Edges<Image>
|
||||
imagesConnection: EdgesWithTotalCount<Image>
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { AllRequestResponse } from "../utils/all"
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { EdgesWithTotalCount } from "../utils/edges"
|
||||
|
||||
interface AccountPageBreadcrumbs {
|
||||
breadcrumbs: {
|
||||
title: string
|
||||
parents: Edges<{
|
||||
parents: EdgesWithTotalCount<{
|
||||
breadcrumbs: {
|
||||
title: string
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { Image } from "../../image"
|
||||
import type { EdgesWithTotalCount } from "../utils/edges"
|
||||
|
||||
export type LogoQueryData = {
|
||||
all_header: {
|
||||
items: {
|
||||
logoConnection: Edges<Image>
|
||||
logoConnection: EdgesWithTotalCount<Image>
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Lang } from "@/constants/languages"
|
||||
import type { System } from "../system"
|
||||
import type { AllRequestResponse } from "../utils/all"
|
||||
import type { Edges } from "../utils/edges"
|
||||
import type { TypenameInterface } from "../utils/typename"
|
||||
@@ -12,10 +13,10 @@ export enum PageLinkEnum {
|
||||
export type MenuItem = {
|
||||
lang: Lang
|
||||
linkText: string
|
||||
subItems: MenuItem[] | null
|
||||
uid: string
|
||||
url: string
|
||||
originalUrl: string | undefined
|
||||
originalUrl?: string
|
||||
subItems?: MenuItem[]
|
||||
}
|
||||
|
||||
export type SidebarProps = {
|
||||
@@ -27,8 +28,8 @@ interface NavigationLink {
|
||||
locale: Lang
|
||||
uid: string
|
||||
}
|
||||
url: string
|
||||
title: string
|
||||
url: string
|
||||
web?: { original_url: string }
|
||||
}
|
||||
|
||||
@@ -46,16 +47,44 @@ export interface ContentPageLink
|
||||
|
||||
export type PageLink = ContentPageLink | AccountPageLink | LoyaltyPageLink
|
||||
|
||||
export type NavigationItem = {
|
||||
item: {
|
||||
pageConnection: Edges<PageLink>
|
||||
link_text: string
|
||||
sub_items: NavigationItem[] | null
|
||||
}
|
||||
interface Item {
|
||||
link_text: string
|
||||
pageConnection: Edges<PageLink>
|
||||
}
|
||||
|
||||
export type NavigationMyPages = { items: NavigationItem[]; title: string }
|
||||
interface ItemWithSubitem extends Item {
|
||||
sub_items: NavigationItem[]
|
||||
}
|
||||
|
||||
export type NavigationItem = {
|
||||
item: Item | ItemWithSubitem
|
||||
}
|
||||
|
||||
export type NavigationMyPages = {
|
||||
items: NavigationItem[]
|
||||
title: string
|
||||
}
|
||||
|
||||
export type GetNavigationMyPagesData = {
|
||||
all_navigation_my_pages: AllRequestResponse<NavigationMyPages>
|
||||
}
|
||||
|
||||
/** Refs Request */
|
||||
type NavigationItemRef = {
|
||||
item: {
|
||||
pageConnection: Edges<System>
|
||||
sub_items: {
|
||||
item: {
|
||||
pageConnection: Edges<System>
|
||||
}
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
interface NavigationMyPagesRefs extends System {
|
||||
items: NavigationItemRef[]
|
||||
}
|
||||
|
||||
export type GetNavigationMyPagesRefsData = {
|
||||
all_navigation_my_pages: AllRequestResponse<NavigationMyPagesRefs>
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { RTEDocument } from "../rte/node"
|
||||
import type { Embeds } from "./embeds"
|
||||
import type { EdgesWithTotalCount } from "./utils/edges"
|
||||
|
||||
export type Preamble = {
|
||||
text: {
|
||||
embedded_itemsConnection: Edges<Embeds>
|
||||
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
|
||||
json: RTEDocument
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Image } from "../image"
|
||||
import type { Edges } from "./utils/edges"
|
||||
import type { RTEDocument } from "../rte/node"
|
||||
import type { EdgesWithTotalCount } from "./utils/edges"
|
||||
|
||||
export enum PuffStyleEnum {
|
||||
button = "button",
|
||||
@@ -8,7 +8,7 @@ export enum PuffStyleEnum {
|
||||
}
|
||||
|
||||
export type Puff = {
|
||||
imageConnection: Edges<Image>
|
||||
imageConnection: EdgesWithTotalCount<Image>
|
||||
link: {
|
||||
href: string
|
||||
title?: string
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface System {
|
||||
system: {
|
||||
content_type_uid: string
|
||||
uid: string
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
export interface AllRequestResponse<T> {
|
||||
items: T[]
|
||||
}
|
||||
|
||||
export interface AllRequestResponseWithTotal<T> {
|
||||
items: T[]
|
||||
total: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,9 @@ export type Node<T> = {
|
||||
|
||||
export type Edges<T> = {
|
||||
edges: Node<T>[]
|
||||
}
|
||||
|
||||
export type EdgesWithTotalCount<T> = {
|
||||
edges: Node<T>[]
|
||||
totalCount: number
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { System } from "../system"
|
||||
|
||||
export interface NodeRefs extends System {}
|
||||
Reference in New Issue
Block a user