Merged in chore/upgrade-next (pull request #3124)
Upgrade next@15.5.6 * chore: upgrade next@15.5.6 * chore: upgrade turborepo@2.6.1 * fix typings for scandic-web * fix: set correct type for pages * cleanup * fix more route.ts typing issues * Merge branch 'master' of bitbucket.org:scandic-swap/web into chore/upgrade-next * explicitly import the types Approved-by: Linus Flood
This commit is contained in:
@@ -5,25 +5,20 @@ import { logger } from "@scandic-hotels/common/logger"
|
||||
import AccountPage from "@/components/Webviews/AccountPage"
|
||||
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
|
||||
|
||||
import type {
|
||||
ContentTypeWebviewParams,
|
||||
LangParams,
|
||||
PageArgs,
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
|
||||
type ContentType = "loyalty-page" | "account-page"
|
||||
export default async function ContentTypePage(
|
||||
props: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams>
|
||||
props: PageProps<"/[lang]/webview/[contentType]/[uid]">
|
||||
) {
|
||||
const params = await props.params
|
||||
const contentType = params.contentType as ContentType
|
||||
|
||||
switch (params.contentType) {
|
||||
switch (contentType) {
|
||||
case "loyalty-page":
|
||||
return <LoyaltyPage />
|
||||
case "account-page":
|
||||
return <AccountPage />
|
||||
default:
|
||||
const type: never = params.contentType
|
||||
const type: never = contentType
|
||||
logger.error(`Unsupported content type given: ${type}`)
|
||||
notFound()
|
||||
}
|
||||
|
||||
@@ -6,33 +6,29 @@ import { myStay } from "@/constants/routes/webviews"
|
||||
|
||||
import GuaranteeCallbackPage from "@/components/GuaranteeCallback"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
||||
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
export default async function GuaranteePaymentWebViewCallbackPage(
|
||||
props: PageArgs<
|
||||
LangParams,
|
||||
{
|
||||
status?: PaymentCallbackStatusEnum
|
||||
RefId?: string
|
||||
confirmationNumber?: string
|
||||
ancillary?: string
|
||||
}
|
||||
>
|
||||
props: PageProps<"/[lang]/webview/hotelreservation/gla-payment-callback">
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const params = await props.params
|
||||
logger.debug(`[gla-payment-callback] callback started`)
|
||||
const lang = params.lang
|
||||
const status = searchParams.status
|
||||
const confirmationNumber = searchParams.confirmationNumber
|
||||
const refId = searchParams.RefId
|
||||
const lang = params.lang as Lang
|
||||
const status = searchParams.status as PaymentCallbackStatusEnum
|
||||
const confirmationNumber =
|
||||
typeof searchParams.confirmationNumber === "string"
|
||||
? searchParams.confirmationNumber
|
||||
: undefined
|
||||
const refId =
|
||||
typeof searchParams.RefId === "string" ? searchParams.RefId : undefined
|
||||
|
||||
if (!status || !confirmationNumber || !refId) {
|
||||
notFound()
|
||||
}
|
||||
const myStayUrl = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
||||
|
||||
logger.debug(`[gla-payment-callback] callback started`)
|
||||
return (
|
||||
<GuaranteeCallbackPage
|
||||
status={status}
|
||||
|
||||
@@ -6,19 +6,21 @@ import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import Tracking from "./tracking"
|
||||
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
export default async function MyStayWebviewPage(
|
||||
props: PageArgs<LangParams, { RefId?: string }>
|
||||
props: PageProps<"/[lang]/webview/hotelreservation/my-stay">
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const params = await props.params
|
||||
setLang(params.lang)
|
||||
const refId = searchParams.RefId
|
||||
const lang = params.lang as Lang
|
||||
setLang(lang)
|
||||
const refId =
|
||||
typeof searchParams.RefId === "string" ? searchParams.RefId : undefined
|
||||
|
||||
return (
|
||||
<Suspense fallback={<MyStaySkeleton />}>
|
||||
<MyStay refId={refId} lang={params.lang} isWebview={true} />
|
||||
<MyStay refId={refId} lang={lang} isWebview={true} />
|
||||
<Tracking />
|
||||
</Suspense>
|
||||
)
|
||||
|
||||
@@ -10,11 +10,7 @@ import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { getIntl } from "@/i18n"
|
||||
|
||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||
|
||||
export default async function Layout(
|
||||
props: React.PropsWithChildren<LayoutArgs<LangParams>>
|
||||
) {
|
||||
export default async function Layout(props: LayoutProps<"/[lang]/webview">) {
|
||||
const params = await props.params
|
||||
|
||||
const { children } = props
|
||||
|
||||
Reference in New Issue
Block a user