fix(BOOK-755, BOOK-787): Fixed issue for phone number and sidepeeks not showing * fix(BOOK-755): Fixed issue for phone number and sidepeeks not showing * fix(BOOK-755): fix issue phonenumber alert * fix(BOOK-755): fix issue phonenumber Approved-by: Matilda Landström
30 lines
816 B
TypeScript
30 lines
816 B
TypeScript
import { Alert } from "@scandic-hotels/design-system/Alert"
|
|
import { getAlertPhoneContactData } from "@scandic-hotels/trpc/routers/contentstack/base/utils"
|
|
|
|
import { serverClient } from "@/lib/trpc/server"
|
|
|
|
import type { AlertBlock } from "@scandic-hotels/trpc/types/blocks"
|
|
|
|
interface AlertBlockProps extends Pick<AlertBlock, "alert"> {}
|
|
|
|
export async function AlertBlock({ alert }: AlertBlockProps) {
|
|
const caller = await serverClient()
|
|
const contactConfig = await caller.contentstack.base.contact()
|
|
if (!alert) {
|
|
return null
|
|
}
|
|
|
|
const phoneContact =
|
|
alert.phoneContact && contactConfig
|
|
? getAlertPhoneContactData(alert, contactConfig)
|
|
: null
|
|
|
|
return (
|
|
<Alert
|
|
{...alert}
|
|
phoneContact={phoneContact}
|
|
sidepeekCtaText={alert.sidepeekButton?.cta_text}
|
|
/>
|
|
)
|
|
}
|