From 8ac9e824769a84554119e01cc9bf0e084384a317 Mon Sep 17 00:00:00 2001 From: "Chuma Mcphoy (We Ahead)" Date: Tue, 30 Sep 2025 14:05:14 +0000 Subject: [PATCH] Merged in fix/LOY-380-fix-promo-login-redirect (pull request #2887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(LOY-380): Redirect back to promo page after login * fix(LOY-380): Fix redirect back to promo page after login Approved-by: Matilda Landström --- .../Hero/PromoLoginButton.tsx | 31 +++++++++++++++++++ .../PromoCampaignPage/Hero/index.tsx | 13 ++------ 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx new file mode 100644 index 000000000..19cbf85e8 --- /dev/null +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/PromoLoginButton.tsx @@ -0,0 +1,31 @@ +"use client" + +import { useIntl } from "react-intl" + +import { login } from "@scandic-hotels/common/constants/routes/handleAuth" +import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname" +import ButtonLink from "@scandic-hotels/design-system/ButtonLink" + +import useLang from "@/hooks/useLang" + +export default function PromoLoginButton() { + const lang = useLang() + const intl = useIntl() + const pathname = useLazyPathname() + const loginHref = pathname + ? `${login[lang]}?redirectTo=${encodeURIComponent(pathname)}` + : login[lang] + + return ( + + {intl.formatMessage({ + defaultMessage: "Log in", + })} + + ) +} diff --git a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx index 74bb0f96b..4694af7e4 100644 --- a/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx +++ b/apps/scandic-web/components/ContentType/PromoCampaignPage/Hero/index.tsx @@ -1,6 +1,5 @@ import { cx } from "class-variance-authority" -import { login } from "@scandic-hotels/common/constants/routes/handleAuth" import { signup } from "@scandic-hotels/common/constants/routes/signup" import ButtonLink from "@scandic-hotels/design-system/ButtonLink" import { Divider } from "@scandic-hotels/design-system/Divider" @@ -15,6 +14,7 @@ import { getLang } from "@/i18n/serverContext" import ActivateOfferButton from "./ActivateOfferButton" import IneligibleMessage from "./IneligibleMessage" +import PromoLoginButton from "./PromoLoginButton" import { isUserEligibleForPromo } from "./utils" import styles from "./hero.module.css" @@ -110,16 +110,7 @@ export default async function PromoCampaignHero({ })}

- - {intl.formatMessage({ - defaultMessage: "Log in", - })} - +