{errorContent.heading}
+{errorContent.message}
+diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 66a471991..905167b2c 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -73,4 +73,8 @@ SAS_AUTH_CLIENTID="" LOKALISE_API_KEY="" +DTMC_ENTRA_ID_CLIENT="" +DTMC_ENTRA_ID_ISSUER="" +DTMC_ENTRA_ID_SECRET="" + CAMPAIGN_PAGES_ENABLED="0" # 0 - disabled, 1 - enabled diff --git a/apps/scandic-web/app/[lang]/(live)/(public)/dtmc/route.ts b/apps/scandic-web/app/[lang]/(live)/(public)/dtmc/route.ts new file mode 100644 index 000000000..de09e6690 --- /dev/null +++ b/apps/scandic-web/app/[lang]/(live)/(public)/dtmc/route.ts @@ -0,0 +1,45 @@ +import { NextResponse } from "next/server" +import { AuthError } from "next-auth" + +import { dtmcApiCallback } from "@/constants/routes/dtmc" +import { env } from "@/env/server" +import { internalServerError, serviceUnavailable } from "@/server/errors/next" + +import { signIn } from "@/auth.dtmc" + +export async function GET() { + try { + const redirectUrl = await signIn( + "microsoft-entra-id", + { + redirectTo: `${env.PUBLIC_URL}${dtmcApiCallback}`, + redirect: false, + }, + { + prompt: "login", + } + ) + + if (redirectUrl) { + console.log(`[dtmc] redirecting to: ${redirectUrl}`) + return NextResponse.redirect(redirectUrl) + } else { + console.error(`[dtmc] missing redirectUrl response from signIn()`) + return internalServerError( + "[dtmc] Missing redirect URL from authentication service" + ) + } + } catch (error) { + if (error instanceof AuthError) { + console.error({ signInAuthError: error }) + return serviceUnavailable( + "[dtmc] Microsoft authentication service unavailable" + ) + } else { + console.error({ signInError: error }) + return internalServerError( + "[dtmc] Unexpected error during authentication" + ) + } + } +} diff --git a/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment/linkEmploymentPage.module.css b/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/linkEmploymentError.module.css similarity index 84% rename from apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment/linkEmploymentPage.module.css rename to apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/linkEmploymentError.module.css index ac9d8e8e1..5b6c33bc2 100644 --- a/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment/linkEmploymentPage.module.css +++ b/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/linkEmploymentError.module.css @@ -20,7 +20,7 @@ } .nav { - padding: var(--Spacing-x2); + padding: var(--Space-x2); display: flex; align-items: center; justify-content: space-between; @@ -50,8 +50,8 @@ display: flex; align-items: center; justify-content: center; - padding-left: var(--Spacing-x3); - padding-right: var(--Spacing-x3); + padding-left: var(--Space-x3); + padding-right: var(--Space-x3); } .card { @@ -62,25 +62,25 @@ padding: var(--Spacing-x5); border-radius: var(--Corner-radius-lg); display: grid; - gap: var(--Spacing-x3); + gap: var(--Space-x3); } .formElements { display: flex; flex-direction: column; - gap: var(--Spacing-x3); + gap: var(--Space-x3); } .checkboxContainer { display: flex; flex-direction: column; - gap: var(--Spacing-x1); + gap: var(--Space-x1); } .checkboxWrapper { display: flex; align-items: center; - gap: var(--Spacing-x-one-and-half); + gap: var(--Space-x15); cursor: pointer; } @@ -110,7 +110,7 @@ } .termsTextFull { - padding-left: var(--Spacing-x5); + padding-left: var(--Space-x5); } .link { @@ -118,3 +118,11 @@ text-decoration: underline; font-weight: var(--Font-weight-Bold); } + +.contactSection { + padding-top: var(--Space-x3); + gap: var(--Space-x15); + display: flex; + flex-direction: column; + place-items: center; +} diff --git a/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/page.tsx b/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/page.tsx new file mode 100644 index 000000000..a27a6a700 --- /dev/null +++ b/apps/scandic-web/app/[lang]/(no-layout)/(protected)/link-employment-error/page.tsx @@ -0,0 +1,146 @@ +"use client" + +import Image from "next/image" +import { useSearchParams } from "next/navigation" +import { type IntlShape, useIntl } from "react-intl" + +import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon" +import ScandicLogoIcon from "@scandic-hotels/design-system/Icons/ScandicLogoIcon" +import { Typography } from "@scandic-hotels/design-system/Typography" + +import { supportEmail, supportPhone } from "@/constants/contactSupport" +import { employeeBenefits } from "@/constants/routes/dtmc" + +import ButtonLink from "@/components/ButtonLink" +import Link from "@/components/TempDesignSystem/Link" +import useLang from "@/hooks/useLang" +import background from "@/public/_static/img/Scandic_Computer_Coffee.png" + +import styles from "./linkEmploymentError.module.css" + +export default function LinkEmploymentErrorPage() { + const lang = useLang() + const intl = useIntl() + const searchParams = useSearchParams() + + const error = searchParams.get("error") + const errorContent = getErrorContent(error, intl) + + return ( +
{errorContent.message}
+- {intl.formatMessage( - { - defaultMessage: - "By accepting the {termsLink}, I agree to link my employment to access benefits. The connection will remain active during my employment or until I opt out by sending an email to Scandic's customer service.", - }, - { - termsLink: ( - // TODO: Update with actual URL for terms and conditions. - - {intl.formatMessage({ - defaultMessage: - "Scandic Family Terms and Conditions", - })} - - ), - } - )} -
-