33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import type { AdminSalesDataManagementVM } from "@hivegrid/view-models";
|
|
import { renderAdminSalesData } from "@hivegrid/ui-subframe";
|
|
|
|
import { defineAdapter } from "./defineAdapter.js";
|
|
|
|
export function toAdminSalesDataProps(
|
|
vm: AdminSalesDataManagementVM
|
|
): AdminSalesDataManagementVM {
|
|
return {
|
|
...vm,
|
|
summary: { ...vm.summary },
|
|
contacts: vm.contacts.map((contact) => ({
|
|
...contact,
|
|
tags: contact.tags.map((tag) => ({ ...tag })),
|
|
customFields: contact.customFields.map((field) => ({ ...field })),
|
|
})),
|
|
tags: vm.tags.map((tag) => ({ ...tag })),
|
|
customFields: vm.customFields.map((field) => ({
|
|
...field,
|
|
options: [...field.options],
|
|
})),
|
|
importJobs: vm.importJobs.map((job) => ({ ...job })),
|
|
exportJobs: vm.exportJobs.map((job) => ({ ...job })),
|
|
permissions: { ...vm.permissions },
|
|
};
|
|
}
|
|
|
|
export const adminSalesDataAdapter = defineAdapter({
|
|
name: "adminSalesData",
|
|
toProps: toAdminSalesDataProps,
|
|
defaultRenderer: renderAdminSalesData,
|
|
});
|