* move types to types file * Create salesforce routing form components * Save salesforce data to routing form * Fixes * Add event type service * Change commenting * Pass data from routing form to CRM * Init Salesforce routing form booking form handler * Salesforce find user associated with lookup field * Add looking up the contact owner * If salesforce is disabled then don't change the Salesforce option * Small refactor * Refactor getting event type app metadata * Refactor eventType service * Type fix * Clean up * Add translations Co-authored-by: Alex van Andel <emrysal@users.noreply.github.com> --------- Co-authored-by: Alex van Andel <emrysal@users.noreply.github.com>
30 lines
918 B
TypeScript
30 lines
918 B
TypeScript
import type { Route, AttributeRoutingConfig } from "../types/types";
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export default function DynamicAppComponent<T extends Record<string, React.ComponentType<any>>>(props: {
|
|
componentMap: T;
|
|
slug: string;
|
|
appData: any;
|
|
route: Route;
|
|
setAttributeRoutingConfig: (id: string, attributeRoutingConfig: Partial<AttributeRoutingConfig>) => void;
|
|
wrapperClassName?: string;
|
|
}) {
|
|
const { componentMap, slug, wrapperClassName, appData, route, setAttributeRoutingConfig, ...rest } = props;
|
|
|
|
// There can be apps with no matching component
|
|
if (!componentMap[slug]) return null;
|
|
|
|
const Component = componentMap[slug];
|
|
|
|
return (
|
|
<div className={wrapperClassName || ""}>
|
|
<Component
|
|
appData={appData}
|
|
route={route}
|
|
setAttributeRoutingConfig={setAttributeRoutingConfig}
|
|
{...rest}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|