import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
import Image from "@scandic-hotels/design-system/Image"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { getEurobonusMembership } from "@scandic-hotels/trpc/routers/user/helpers"
import { getProfileWithExtendedPartnerData } from "@/lib/trpc/memoizedRequests"
import { getIntl } from "@/i18n"
import desktopBackground from "@/public/_static/img/sas/sas-scandic-link-account-banner-desktop.png"
import mobileBackground from "@/public/_static/img/sas/sas-scandic-link-account-banner-mobile.png"
import styles from "./linkAccountBanner.module.css"
import type { DynamicContentProps } from "@/types/components/blocks/dynamicContent"
export default async function SASLinkAccountBanner(
props: DynamicContentProps["dynamic_content"]
) {
const intl = await getIntl()
const user = await getProfileWithExtendedPartnerData()
if (!user || "error" in user || !user.loyalty) {
return null
}
const sasMembership = getEurobonusMembership(user.loyalty)
if (sasMembership) {
return null
}
const headingText = intl.formatMessage({
id: "sas.linkAccountBanner.earnFlightsWithNights",
defaultMessage: "Earn flights with nights",
})
const buttonText =
props.link?.text ||
intl.formatMessage({
id: "sas.linkAccountBanner.readMoreAndLinkAccounts",
defaultMessage: "Read more and link accounts",
})
function scandicFriends() {
return (
{intl.formatMessage({
id: "common.scandicFriends",
defaultMessage: "Scandic Friends",
})}
)
}
function sasEuroBonus() {
return (
{intl.formatMessage({
id: "partnerSas.sasEuroBonus",
defaultMessage: "SAS EuroBonus",
})}
)
}
const descriptionText = intl.formatMessage(
{
id: "sas.linkAccountBanner.description",
defaultMessage:
"Link your
{descriptionText}