feat(SW-497): Changes to global alert schema
This commit is contained in:
@@ -7,7 +7,7 @@ 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"
|
||||
import { Alert } from "@/types/trpc/routers/contentstack/siteConfig"
|
||||
|
||||
export function getConnections({ header }: HeaderRefs) {
|
||||
const connections: System["system"][] = [header.system]
|
||||
@@ -71,18 +71,16 @@ export function getFooterConnections(refs: FooterRefDataRaw) {
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getGlobalAlertPhoneContactData(
|
||||
globalAlert: SiteConfig["globalAlert"],
|
||||
export function getAlertPhoneContactData(
|
||||
alert: Alert,
|
||||
contactConfig: ContactConfig
|
||||
) {
|
||||
if (globalAlert?.phone_contact) {
|
||||
const { display_text, phone_number, footnote } = globalAlert.phone_contact
|
||||
if (alert.phoneContact) {
|
||||
const { displayText, phoneNumber, footnote } = alert.phoneContact
|
||||
|
||||
return {
|
||||
display_text,
|
||||
phone: phone_number
|
||||
? getValueFromContactConfig(phone_number, contactConfig)
|
||||
: null,
|
||||
displayText,
|
||||
phoneNumber: getValueFromContactConfig(phoneNumber, contactConfig),
|
||||
footnote: footnote
|
||||
? getValueFromContactConfig(footnote, contactConfig)
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user