import type { AdminLeadListVM } from "@hivegrid/view-models"; import { renderPlatformLeads } from "@hivegrid/ui-subframe"; import { defineAdapter } from "./defineAdapter.js"; /** * Copies the loader-built R-LEADS model at the UI boundary. Keeping this * explicit prevents the later Subframe delta from reaching into route data. */ export function toPlatformLeadsProps(vm: AdminLeadListVM): AdminLeadListVM { return { ...vm, rows: vm.rows.map((row) => ({ ...row })), sourceOptions: vm.sourceOptions.map((option) => ({ ...option })), assigneeOptions: vm.assigneeOptions.map((option) => ({ ...option })), filters: { ...vm.filters }, summary: { ...vm.summary }, pagination: { ...vm.pagination }, permissions: { ...vm.permissions }, }; } export const platformLeadsAdapter = defineAdapter({ name: "platformLeads", toProps: toPlatformLeadsProps, defaultRenderer: renderPlatformLeads, });