import React, { useMemo } from 'react';
import { UdpFormRenderer } from './UdpFormRenderer';
import { useHistory } from 'react-router-dom';
import { useUser } from '../../../utilities/auth/useUser';
import { useTenant } from '../../../utilities/tenant/useTenant';
import { useActions } from '../../../hooks/useActions';
import { useSnackbar } from 'notistack';
import { useUdpFormParameters } from '../UdpFormsUtils/Utils';
export const UdpPrivateForm = (props) => {
    const user = useUser();
    const tenant = useTenant();
    const history = useHistory();
    const { enqueueSnackbar, closeSnackbar } = useSnackbar();
    const { triggerAction } = useActions();
    const { formId, formVersion, submissionId, urlContext } = useUdpFormParameters();
    const mergedContext = useMemo(() => (Object.assign(Object.assign({}, urlContext), { generic1: props.generic1 || urlContext.generic1, generic2: props.generic2 || urlContext.generic2, generic3: props.generic3 || urlContext.generic3 })), [urlContext, props.generic1, props.generic2, props.generic3]);
    return (React.createElement(UdpFormRenderer, Object.assign({ isPublicMode: false, formId: formId, formVersion: formVersion, submissionId: submissionId, tenantId: tenant === null || tenant === void 0 ? void 0 : tenant.id, urlContext: mergedContext, callbackUrl: null, triggerAction: triggerAction, history: history, getUserCallback: () => user, enqueueSnackbar: enqueueSnackbar, closeSnackbar: closeSnackbar }, props)));
};
//# sourceMappingURL=UdpPrivateForm.js.map