Files
carmanagement/apps/public-site/src/lib/pageSections.ts
T
2026-05-07 00:34:29 -04:00

30 lines
1.1 KiB
TypeScript

import {
clonePublicSitePageSections,
type PublicSitePageSections,
} from '@rentaldrivego/types'
type MaybePageSections = {
pageSections?: Partial<PublicSitePageSections> | null
} | null | undefined
export function resolvePageSectionsConfig(menuConfig: MaybePageSections): PublicSitePageSections {
const defaults = clonePublicSitePageSections()
const custom = menuConfig?.pageSections ?? {}
return {
home: { ...defaults.home, ...(custom.home ?? {}) },
about: { ...defaults.about, ...(custom.about ?? {}) },
offers: { ...defaults.offers, ...(custom.offers ?? {}) },
pricing: { ...defaults.pricing, ...(custom.pricing ?? {}) },
vehicles: { ...defaults.vehicles, ...(custom.vehicles ?? {}) },
vehicleDetail: { ...defaults.vehicleDetail, ...(custom.vehicleDetail ?? {}) },
blog: { ...defaults.blog, ...(custom.blog ?? {}) },
contact: { ...defaults.contact, ...(custom.contact ?? {}) },
booking: { ...defaults.booking, ...(custom.booking ?? {}) },
bookingConfirmation: {
...defaults.bookingConfirmation,
...(custom.bookingConfirmation ?? {}),
},
}
}