Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/routes/b.$tenant.$slug.embed.tsx
T

28 lines
1.4 KiB
TypeScript

// AK-P16b · iframe embed variant `/b/{tenant}/{slug}/embed` (M06 Block H). Same
// loader/action as the canonical page; the loader detects `/embed` and drops the
// branding chrome. The permissive frame-ancestors header makes it embeddable on any
// tenant website (the page exposes only published, public booking data).
import { publicBookingLoader, publicBookingAction } from "~/modules/booking/routes/PublicBooking.server";
import PublicBookingRoute from "~/modules/booking/components/PublicBookingRoute";
import ServerError from "~/components/ui/errors/ServerError";
import type { HeadersFunction } from "react-router";
import { buildDocumentContentSecurityPolicy, getCspNonceFromHeaders } from "~/utils/security/contentSecurityPolicy";
const BOOKING_EMBED_ROUTE_CSP = "base-uri 'self'; object-src 'none'; form-action 'self'; script-src-attr 'none'; frame-ancestors *";
export const headers: HeadersFunction = ({ loaderHeaders, parentHeaders, actionHeaders }) => {
const nonce = getCspNonceFromHeaders(loaderHeaders, parentHeaders, actionHeaders);
return {
"Content-Security-Policy": nonce ? buildDocumentContentSecurityPolicy(nonce, BOOKING_EMBED_ROUTE_CSP) : BOOKING_EMBED_ROUTE_CSP,
};
};
export const loader = publicBookingLoader;
export const action = publicBookingAction;
export default PublicBookingRoute;
export function ErrorBoundary() {
return <ServerError />;
}