feat(SW-497): Changed to siteConfig which includes Global Alert
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import type {
|
||||
FooterLinkItem,
|
||||
FooterRefDataRaw,
|
||||
} from "@/types/components/footer/footer"
|
||||
import { getValueFromContactConfig } from "@/utils/contactConfig"
|
||||
|
||||
import { ContactConfig } from "./output"
|
||||
|
||||
import type { FooterRefDataRaw } from "@/types/components/footer/footer"
|
||||
import { System } from "@/types/requests/system"
|
||||
import { Edges } from "@/types/requests/utils/edges"
|
||||
import { NodeRefs } from "@/types/requests/utils/refs"
|
||||
import type { HeaderRefs } from "@/types/trpc/routers/contentstack/header"
|
||||
import { SiteConfig } from "@/types/trpc/routers/contentstack/siteConfig"
|
||||
|
||||
export function getConnections({ header }: HeaderRefs) {
|
||||
const connections: System["system"][] = [header.system]
|
||||
@@ -68,3 +70,23 @@ export function getFooterConnections(refs: FooterRefDataRaw) {
|
||||
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getGlobalAlertPhoneContactData(
|
||||
globalAlert: SiteConfig["globalAlert"],
|
||||
contactConfig: ContactConfig
|
||||
) {
|
||||
if (globalAlert?.phone_contact) {
|
||||
const { display_text, phone_number, footnote } = globalAlert.phone_contact
|
||||
|
||||
return {
|
||||
display_text,
|
||||
phone: phone_number
|
||||
? getValueFromContactConfig(phone_number, contactConfig)
|
||||
: null,
|
||||
footnote: footnote
|
||||
? getValueFromContactConfig(footnote, contactConfig)
|
||||
: null,
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user