import { ConfigService } from "../../../configService/index.mjs";
import { UdpSearchEnums } from "../../../enums/unitySystemEnums.mjs";
import { useUser } from "../../../utilities/auth/useUser.mjs";
import { apiMutate } from "../../../utilities/useAxiosMutate.mjs";
import { PropertyTypeEnum } from "../../../enums/propertyTypeEnums.mjs";
import { getSuccessAction } from "../../../UI/SuccessAction.mjs";
import { useCatalogStore } from "../../../stores/catalogStore.mjs";
import { useAxiosGet } from "../../../utilities/useAxiosGet.mjs";
import { FluentDialog } from "../../../UI/feedback/FluentDialog.mjs";
import { LinearProgress as LinearProgress$1 } from "../../../UI/loading/LinearProgress.mjs";
import { SearchMethodUdpGrid } from "../../../UI/templates/newGrid/SearchMethodUdpGrid.mjs";
import UdpTransactionTypeSidesheet from "./sidesheets/UdpTransactionTypeSidesheet.mjs";
import UdpTransactionTypeStatusSidesheet_default from "./sidesheets/UdpTransactionTypeStatusSidesheet.mjs";
import UdpTransactionTypeTransactionActionSidesheet_default from "./sidesheets/UdpTransactionTypeTransactionActionSidesheet.mjs";
import UdpTransactionUiActionSidesheet_default from "./sidesheets/UdpTransactionUiActionSidesheet.mjs";
import UdpTransactionTypeConfigurationSidesheet_default from "./sidesheets/UdpTransactionTypeConfigurationSidesheet.mjs";
import UdpTransactionAttachmentTypeSidesheet_default from "./sidesheets/UdpTransactionAttachmentTypeSidesheet.mjs";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { makeStyles } from "@material-ui/core";
import { useSnackbar } from "notistack";
import { useTranslation } from "react-i18next";
//#region src/udp/pages/UdpTransactionTypesPage/UdpTransactionTypesPage.jsx
const REQUIRED_COLUMN_DEF_MAPPING = {
	attachments: { displayName: "Attachments" },
	actions: { displayName: "Actions" },
	transactionId: { displayName: "Transaction Id" },
	createdOn: { displayName: "Created On" },
	currentStatusId: { displayName: "Current Status" },
	currentRevisionNo: { displayName: "Revision No" },
	lastEventTypeId: { displayName: "Last Event Type" }
};
const REQUIRED_COLUMN_DEF_FIELDS = Object.keys(REQUIRED_COLUMN_DEF_MAPPING);
const DISABLE_ORDERING_FOR_FIELDS = ["attachments", "actions"];
const baseSearchPayload = {
	pageNumber: 1,
	pageSize: 100,
	filterElements: [],
	filterGroups: [],
	orderElements: [],
	groupingType: "",
	groupProperty: [],
	groupOperationList: [],
	eagerLoad: false,
	logicalSearchOperator: 1
};
const useStyles = makeStyles((theme) => ({ loadingBar: {
	bottom: theme.spacing(-.5),
	marginLeft: theme.spacing(.5),
	marginRight: theme.spacing(.5)
} }));
/**
* This function formats the 'Configuration' data into a specific format that can be
* used by the external library jsonLogic. The formatted data is stored in the
* udp.TransactionTypeConfiguration table in the ExpressionLogic column.
*/
const formatTransactionTypeConfigurationIntoExpressionLogic = (configurationObj) => {
	if (!configurationObj || typeof configurationObj !== "object") return "";
	const { CurrentStatus, CurrentDomainValue, TenantUserRoleIds } = configurationObj;
	const andConditions = [];
	if (CurrentStatus) andConditions.push({ "==": [{ var: "currentStatusId" }, CurrentStatus?.transactionTypeStatusId === "00000000-0000-0000-0000-000000000000" ? null : CurrentStatus?.transactionTypeStatusId] });
	if (CurrentDomainValue && typeof CurrentDomainValue === "object") Object.entries(CurrentDomainValue).forEach(([field, config]) => {
		if (!field || !config) return;
		const isConfigObject = config && typeof config === "object" && !Array.isArray(config);
		const operator = isConfigObject ? config?.operator : null;
		const comparisonValue = isConfigObject ? config?.value : config;
		const effectiveOperator = operator || "==";
		const operands = effectiveOperator === "!" || effectiveOperator === "!!" ? [{ var: `currentDomainValue.${field}` }] : [{ var: `currentDomainValue.${field}` }, comparisonValue];
		andConditions.push({ [effectiveOperator]: operands });
	});
	if (Array.isArray(TenantUserRoleIds) && TenantUserRoleIds.length > 0) andConditions.push({ some: [{ var: "tenantUserRoleIds" }, { in: [{ var: "" }, TenantUserRoleIds] }] });
	if (!andConditions.length) return "";
	return { and: andConditions };
};
const UdpTransactionTypesPage = () => {
	const user = useUser();
	const { t } = useTranslation();
	const classes = useStyles();
	const { enqueueSnackbar, closeSnackbar } = useSnackbar();
	const successAction = getSuccessAction(closeSnackbar);
	const gridApiRef = useRef(null);
	const ttsGridApiRef = useRef(null);
	const tttaGridApiRef = useRef(null);
	const tuaGridApiRef = useRef(null);
	const ttcGridApiRef = useRef(null);
	const ttctaGridApiRef = useRef(null);
	const tatGridApiRef = useRef(null);
	const [searchObject, setSearchObject] = useState(baseSearchPayload);
	const [selectedTransactionType, setSelectedTransactionType] = useState(null);
	const [isTransactionTypeSideSheetOpen, setIsTransactionTypeSideSheetOpen] = useState(false);
	const [isTransactionTypeSidesheetLoading, setIsTransactionTypeSidesheetLoading] = useState(false);
	const [isDeleteTransactionTypeDialogOpen, setIsDeleteTransactionTypeDialogOpen] = useState(false);
	const [isPageConfigurationSidesheetOpen, setIsPageConfigurationSidesheetOpen] = useState(false);
	const [isCalendarViewConfigurationSidesheetOpen, setIsCalendarViewConfigurationSidesheetOpen] = useState(false);
	const [selectedDomainName, setSelectedDomainName] = useState("");
	const [isTransactionTypeStatusSidesheetOpen, setIsTransactionTypeStatusSidesheetOpen] = useState(false);
	const [isDeleteTransactionTypeStatusDialogOpen, setIsDeleteTransactionTypeStatusDialogOpen] = useState(false);
	const [selectedTransactionTypeStatus, setSelectedTransactionTypeStatus] = useState(null);
	const [isCreateOrEditTransactionTypeStatusSidesheetOpen, setIsCreateOrEditTransactionTypeStatusSidesheetOpen] = useState(false);
	const [ttstatuses, setTTStatuses] = useState([]);
	const [isTransactionTypeTransactionActionSidesheetOpen, setIsTransactionTypeTransactionActionSidesheetOpen] = useState(false);
	const [selectedTransactionTypeTransactionAction, setSelectedTransactionTypeTransactionAction] = useState(null);
	const [isCreateOrEditTransactionTypeTransactionActionSidesheetOpen, setIsCreateOrEditTransactionTypeTransactionActionSidesheetOpen] = useState(false);
	const [isDeleteTransactionTypeTransactionActionDialogOpen, setIsDeleteTransactionTypeTransactionActionDialogOpen] = useState(false);
	const [tttactions, setTTTActions] = useState([]);
	const [isTransactionUiActionSidesheetOpen, setIsTransactionUiActionSidesheetOpen] = useState(false);
	const [selectedTransactionUiAction, setSelectedTransactionUiAction] = useState(null);
	const [isCreateOrEditTransactionUiActionSidesheetOpen, setIsCreateOrEditTransactionUiActionSidesheetOpen] = useState(false);
	const [isDeleteTransactionUiActionDialogOpen, setIsDeleteTransactionUiActionDialogOpen] = useState(false);
	const [isTransactionTypeConfigurationSidesheetOpen, setIsTransactionTypeConfigurationSidesheetOpen] = useState(false);
	const [selectedTransactionTypeConfiguration, setSelectedTransactionTypeConfiguration] = useState(null);
	const [isCreateOrEditTransactionTypeConfigurationSidesheetOpen, setIsCreateOrEditTransactionTypeConfigurationSidesheetOpen] = useState(false);
	const [isDeleteTransactionTypeConfigurationDialogOpen, setIsDeleteTransactionTypeConfigurationDialogOpen] = useState(false);
	const [isTransactionTypeConfigurationTransactionActionSidesheetOpen, setIsTransactionTypeConfigurationTransactionActionSidesheetOpen] = useState(false);
	const [selectedTransactionTypeConfigurationTransactionAction, setSelectedTransactionTypeConfigurationTransactionAction] = useState(null);
	const [isCreateOrEditTransactionTypeConfigurationTransactionActionSidesheetOpen, setIsCreateOrEditTransactionTypeConfigurationTransactionActionSidesheetOpen] = useState(false);
	const [isDeleteTransactionTypeConfigurationTransactionActionDialogOpen, setIsDeleteTransactionTypeConfigurationTransactionActionDialogOpen] = useState(false);
	const [isTransactionAttachmentTypeSidesheetOpen, setIsTransactionAttachmentTypeSidesheetOpen] = useState(false);
	const [selectedTransactionAttachmentType, setSelectedTransactionAttachmentType] = useState(null);
	const [isCreateOrEditTransactionAttachmentTypeSidesheetOpen, setIsCreateOrEditTransactionAttachmentTypeSidesheetOpen] = useState(false);
	const [isDeleteTransactionAttachmentTypeDialogOpen, setIsDeleteTransactionAttachmentTypeDialogOpen] = useState(false);
	const hasDefaultAndCancelledTransactionTypeStatus = useCallback((transactionTypeStatuses, checkHasDefault = false, checkHasCancelledStatus = false) => {
		if (!transactionTypeStatuses) return false;
		return transactionTypeStatuses?.some((record) => {
			if (record.transactionTypeStatusId !== selectedTransactionTypeStatus?.transactionTypeStatusId) {
				const isDefault = record?.isDefault;
				const isCancelledStatus = record?.isCancelledStatus;
				if (checkHasDefault && isDefault) return true;
				if (checkHasCancelledStatus && isCancelledStatus) return true;
			}
			return false;
		});
	}, [selectedTransactionTypeStatus]);
	/** TransactionType */
	const postCreateTransactionType = async (transactionType) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionType`, { method: "POST" }, { data: transactionType });
	};
	const putUpdateTransactionType = async (transactionTypeId, transactionType_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionType/${transactionTypeId}`, { method: "PUT" }, { data: transactionType_0 });
	};
	const deleteTransactionType = async (transactionTypeId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionType/${transactionTypeId_0}`, { method: "DELETE" });
	};
	const [{ data: transactionsByTransactionTypeId, loading: getTransactionsByTransactionIdLoading }, fetchTransactionsByTransactionTypeId] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransaction/search`, {
		method: "post",
		data: {
			filterElements: [{
				searchField: "TransactionTypeId",
				searchOperator: "=",
				searchValue: selectedTransactionType?.transactionTypeId,
				groupId: 1
			}],
			getAll: true
		}
	}, !!!selectedTransactionType?.transactionTypeId || !!!isDeleteTransactionTypeDialogOpen, false);
	/** TransactionTypeStatus */
	const postCreateTransactionTypeStatus = async (transactionTypeStatus) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeStatus`, { method: "POST" }, { data: transactionTypeStatus });
	};
	const putUpdateTransactionTypeStatus = async (transactionTypeStatusId, transactionTypeStatus_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeStatus/${transactionTypeStatusId}`, { method: "PUT" }, { data: transactionTypeStatus_0 });
	};
	const deleteTransactionTypeStatus = async (transactionTypeStatusId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeStatus/${transactionTypeStatusId_0}`, { method: "DELETE" });
	};
	const searchTransactionTypeStatusByTransactionTypeId = useCallback(async (transactionTypeId_1) => {
		const searchPayload = {
			filterElements: [{
				searchField: "TransactionTypeId",
				searchOperator: "=",
				searchValue: transactionTypeId_1,
				groupId: 1
			}],
			getAll: true
		};
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeStatus/search`, { method: "POST" }, { data: searchPayload });
	}, []);
	useEffect(() => {
		if (!selectedTransactionType?.transactionTypeId) return;
		const loadTTStatuses = async () => {
			const ttsResponse = await searchTransactionTypeStatusByTransactionTypeId(selectedTransactionType?.transactionTypeId);
			if (ttsResponse?.status === 200) setTTStatuses(ttsResponse.data?.pageList);
		};
		if (isTransactionTypeStatusSidesheetOpen || isTransactionTypeConfigurationSidesheetOpen || isTransactionTypeTransactionActionSidesheetOpen) loadTTStatuses();
	}, [
		searchTransactionTypeStatusByTransactionTypeId,
		isTransactionTypeStatusSidesheetOpen,
		isTransactionTypeConfigurationSidesheetOpen,
		isTransactionTypeTransactionActionSidesheetOpen
	]);
	/** TransactionAction */
	const [{ data: transactionActions }] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionAction`, { method: "GET" }, false, false);
	/** ActionApis */
	const [{ data: actionApis }] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionWorkflowActionApi`, { method: "GET" }, false, false);
	/** PageIds */
	const [{ data: pages }] = useAxiosGet(ConfigService.tenantV1ApiUrl, `Page?tenantId=${user?.currentTenantId}`, { method: "GET" }, !!!user?.currentTenantId, false);
	/** TransactionTypeTransactionAction */
	const postCreateTransactionTypeTransactionAction = async (transactionTypeTransactionAction) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeTransactionAction`, { method: "POST" }, { data: transactionTypeTransactionAction });
	};
	const putUpdateTransactionTypeTransactionAction = async (transactionTypeTransactionActionId, transactionTypeTransactionAction_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeTransactionAction/${transactionTypeTransactionActionId}`, { method: "PUT" }, { data: transactionTypeTransactionAction_0 });
	};
	const deleteTransactionTypeTransactionAction = async (transactionTypeTransactionActionId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeTransactionAction/${transactionTypeTransactionActionId_0}`, { method: "DELETE" });
	};
	const searchTransactionTypeTransactionActionByTransactionTypeId = useCallback(async (transactionTypeId_2) => {
		const searchPayload_0 = {
			filterElements: [{
				searchField: "TransactionTypeId",
				searchOperator: "=",
				searchValue: transactionTypeId_2,
				groupId: 1
			}],
			getAll: true
		};
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeTransactionAction/search`, { method: "POST" }, { data: searchPayload_0 });
	}, []);
	useEffect(() => {
		if (!selectedTransactionType?.transactionTypeId) return;
		const loadTTTActions = async () => {
			const tttaResponse = await searchTransactionTypeTransactionActionByTransactionTypeId(selectedTransactionType?.transactionTypeId);
			if (tttaResponse?.status === 200) setTTTActions(tttaResponse.data?.pageList);
		};
		if (isTransactionTypeConfigurationTransactionActionSidesheetOpen) loadTTTActions();
	}, [searchTransactionTypeTransactionActionByTransactionTypeId, isTransactionTypeConfigurationTransactionActionSidesheetOpen]);
	/** TransactionUiAction */
	const postCreateTransactionUiAction = async (transactionUiAction) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionUiAction`, { method: "POST" }, { data: transactionUiAction });
	};
	const putUpdateTransactionUiAction = async (transactionUiActionId, transactionUiAction_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionUiAction/${transactionUiActionId}`, { method: "PUT" }, { data: transactionUiAction_0 });
	};
	const deleteTransactionUiAction = async (transactionUiActionId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionUiAction/${transactionUiActionId_0}`, { method: "DELETE" });
	};
	const [{ data: tUiActionsList }, fetchTUiActionsList] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionUiAction/search`, {
		method: "post",
		data: {
			filterElements: [{
				searchField: "TransactionTypeId",
				searchOperator: "=",
				searchValue: selectedTransactionType?.transactionTypeId,
				groupId: 1
			}],
			getAll: true
		}
	}, !!!isTransactionUiActionSidesheetOpen, false);
	/** TransactionUiActionType */
	const [{ data: transactionUiActionTypes }] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionUiActionType`, { method: "GET" }, false, false);
	/** TransactionTypeConfiguration */
	const postCreateTransactionTypeConfiguration = async (transactionTypeConfiguration) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfiguration`, { method: "POST" }, { data: transactionTypeConfiguration });
	};
	const putUpdateTransactionTypeConfiguration = async (transactionTypeConfigurationId, transactionTypeConfiguration_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfiguration/${transactionTypeConfigurationId}`, { method: "PUT" }, { data: transactionTypeConfiguration_0 });
	};
	const deleteTransactionTypeConfiguration = async (transactionTypeConfigurationId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfiguration/${transactionTypeConfigurationId_0}`, { method: "DELETE" });
	};
	/** TransactionRuleType */
	const [{ data: transactionRuleTypes }] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionRuleType`, { method: "GET" }, false, false);
	/** Roles */
	const [{ data: roles }] = useAxiosGet(ConfigService.tenantV1ApiUrl, `Roles?tenantId=${user?.currentTenantId}`, { method: "GET" }, !!!user?.currentTenantId, false);
	/** TransactionTypeConfigurationTransactionAction */
	const postCreateTransactionTypeConfigurationTransactionAction = async (ttcta) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfigurationTransactionAction/createBulk`, { method: "POST" }, { data: ttcta });
	};
	const putUpdateTransactionTypeConfigurationTransactionAction = async (transactionTypeConfigurationId_1, transactionTypeTransactionActionId_1, transactionTypeConfigurationTransactionAction) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfigurationTransactionAction/${transactionTypeConfigurationId_1}/${transactionTypeTransactionActionId_1}`, { method: "PUT" }, { data: transactionTypeConfigurationTransactionAction });
	};
	const deleteTransactionTypeConfigurationTransactionAction = async (transactionTypeConfigurationId_2, transactionTypeTransactionActionId_2) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfigurationTransactionAction/${transactionTypeConfigurationId_2}/${transactionTypeTransactionActionId_2}`, { method: "DELETE" });
	};
	const [{ data: ttctaList }, fetchTtctaList] = useAxiosGet(ConfigService.productV1ApiUrl, `UdpTransactionTypeConfigurationTransactionAction/search`, {
		method: "post",
		data: {
			filterElements: [{
				searchField: "TransactionTypeConfigurationId",
				searchOperator: "=",
				searchValue: selectedTransactionTypeConfiguration?.transactionTypeConfigurationId,
				groupId: 1
			}],
			getAll: true
		}
	}, !!!selectedTransactionTypeConfiguration?.transactionTypeConfigurationId, false);
	/** TransactionAttachmenType */
	const postCreateTransactionAttachmentType = async (transactionAttachmentType) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionAttachmentType`, { method: "POST" }, { data: transactionAttachmentType });
	};
	const putUpdateTransactionAttachmentType = async (transactionAttachmentTypeId, transactionAttachmentType_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionAttachmentType/${transactionAttachmentTypeId}`, { method: "PUT" }, { data: transactionAttachmentType_0 });
	};
	const deleteTransactionAttachmentType = async (transactionAttachmentTypeId_0) => {
		return await apiMutate(ConfigService.productV1ApiUrl, `UdpTransactionAttachmentType/${transactionAttachmentTypeId_0}`, { method: "DELETE" });
	};
	const currentApiCatalogId = useCatalogStore((state) => state.currentApiCatalogId);
	const [{ data: catalogObjectNames }] = useAxiosGet(ConfigService.integrationV2ApiUrl, `apiCatalog/${currentApiCatalogId}/catalogObjectNames?modelsOnly=true`, {}, !!!currentApiCatalogId, false);
	const domainName = selectedDomainName || selectedTransactionType?.domainName;
	const [{ data: catalogObject }] = useAxiosGet(ConfigService.integrationV2ApiUrl, `apiCatalog/${currentApiCatalogId}/catalogObject/${domainName}`, {}, !!!currentApiCatalogId || !!!domainName, false);
	const catalogObjectProperties = useMemo(() => {
		if (!selectedDomainName || !catalogObject?.properties) return [];
		return catalogObject.properties.filter((property) => property.name !== "businessObjectKey" && property.name !== null).map((property_0) => property_0.name);
	}, [catalogObject, selectedDomainName]);
	const catalogObjectDateProperties = useMemo(() => {
		if (!selectedDomainName || !catalogObject?.properties) return [];
		return catalogObject.properties.filter((property_1) => property_1.name !== "businessObjectKey" && property_1.name !== null && property_1.type === PropertyTypeEnum.DateTime).map((property_2) => property_2.name);
	}, [catalogObject, selectedDomainName]);
	/** Sidesheet handlers */
	const handleSideSheet = useCallback((isOpen, transactionType_1) => {
		setIsTransactionTypeSideSheetOpen(isOpen);
		setSelectedTransactionType(transactionType_1);
	}, []);
	const handleTransactionTypeStatusSideSheet = useCallback((isOpen_0, transactionType_2) => {
		setIsTransactionTypeStatusSidesheetOpen(isOpen_0);
		setSelectedTransactionType(transactionType_2);
	}, []);
	const handleCreateOrEditTransactionTypeStatusSideSheet = useCallback((isOpen_1, transactionTypeStatus_1) => {
		setIsCreateOrEditTransactionTypeStatusSidesheetOpen(isOpen_1);
		setSelectedTransactionTypeStatus(transactionTypeStatus_1);
	}, []);
	const handleTransactionTypeTransactionActionSidesheet = useCallback((isOpen_2, transactionType_3) => {
		setIsTransactionTypeTransactionActionSidesheetOpen(isOpen_2);
		setSelectedTransactionType(transactionType_3);
	}, []);
	const handleCreateOrEditTransactionTypeTransactionActionSidesheet = useCallback((isOpen_3, transactionTypeTransactionAction_1) => {
		setIsCreateOrEditTransactionTypeTransactionActionSidesheetOpen(isOpen_3);
		setSelectedTransactionTypeTransactionAction(transactionTypeTransactionAction_1);
	}, []);
	const handleTransactionUiActionSidesheet = useCallback((isOpen_4, transactionType_4) => {
		setIsTransactionUiActionSidesheetOpen(isOpen_4);
		setSelectedTransactionType(transactionType_4);
	}, []);
	const handleCreateOrEditTransactionUiActionSidesheet = useCallback((isOpen_5, transactionUiAction_1) => {
		setIsCreateOrEditTransactionUiActionSidesheetOpen(isOpen_5);
		setSelectedTransactionUiAction(transactionUiAction_1);
	}, []);
	const handleTransactionTypeConfigurationSidesheet = useCallback((isOpen_6, transactionType_5) => {
		setIsTransactionTypeConfigurationSidesheetOpen(isOpen_6);
		setSelectedTransactionType(transactionType_5);
	}, []);
	const handleCreateOrEditTransactionTypeConfigurationSidesheet = useCallback((isOpen_7, transactionTypeConfiguration_1) => {
		setIsCreateOrEditTransactionTypeConfigurationSidesheetOpen(isOpen_7);
		setSelectedTransactionTypeConfiguration(transactionTypeConfiguration_1);
	}, []);
	const handleTransactionTypeConfigurationTransactionActionSidesheet = useCallback((isOpen_8, transactionTypeConfiguration_2) => {
		setIsTransactionTypeConfigurationTransactionActionSidesheetOpen(isOpen_8);
		setSelectedTransactionTypeConfiguration(transactionTypeConfiguration_2);
	}, []);
	const handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet = useCallback((isOpen_9, transactionTypeConfigurationTransactionAction_0) => {
		setIsCreateOrEditTransactionTypeConfigurationTransactionActionSidesheetOpen(isOpen_9);
		setSelectedTransactionTypeConfigurationTransactionAction(transactionTypeConfigurationTransactionAction_0);
	}, []);
	const handleTransactionAttachmentTypeSidesheet = useCallback((isOpen_10, transactionType_6) => {
		setIsTransactionAttachmentTypeSidesheetOpen(isOpen_10);
		setSelectedTransactionType(transactionType_6);
	}, []);
	const handleCreateOrEditTransactionAttachmentTypeSidesheet = useCallback((isOpen_11, transactionAttachmentType_1) => {
		setIsCreateOrEditTransactionAttachmentTypeSidesheetOpen(isOpen_11);
		setSelectedTransactionAttachmentType(transactionAttachmentType_1);
	}, []);
	/** TransactionType */
	const handleCreateTransactionType = useCallback(async (formValues) => {
		const { domainFields, ...restValues } = formValues;
		const { pageConfigurationColumnDefsDict, domainFieldsDict } = (Array.isArray(domainFields) ? domainFields : []).reduce((accumulator, entry) => {
			if (!entry || !entry[0]) return accumulator;
			const field = entry[0];
			let fieldKey = field;
			if (catalogObjectProperties.includes(fieldKey)) fieldKey = `${UdpSearchEnums.UdpBusinessDomainPrefix}_${fieldKey}`;
			const config = entry[1] || {};
			const displayName = config.displayName || field;
			const order = config.order || 0;
			const hide = config.hide || false;
			accumulator.pageConfigurationColumnDefsDict[fieldKey] = {
				displayName,
				order,
				hide
			};
			if (!REQUIRED_COLUMN_DEF_FIELDS.includes(field)) accumulator.domainFieldsDict[field] = {
				displayName,
				order,
				hide
			};
			return accumulator;
		}, {
			pageConfigurationColumnDefsDict: {},
			domainFieldsDict: {}
		});
		const pageConfiguration = {
			gridTitle: restValues?.gridTitle || "",
			createTransactionButtonLabel: restValues?.createTransactionButtonLabel || "",
			hideCreateTransaction: restValues?.hideCreateTransaction,
			paginationAutoPageSize: restValues?.paginationAutoPageSize,
			hideSaveChanges: restValues?.hideSaveChanges,
			columnDefProperties: pageConfigurationColumnDefsDict,
			calendarViewConfiguration: {
				enabled: !!restValues?.calendarViewEnabled,
				isDefaultView: !!restValues?.calendarViewEnabled && !!restValues?.isDefaultView,
				defaultCalendarViewType: restValues?.defaultCalendarViewType || "",
				domainStartDateProperty: restValues?.domainStartDateProperty || "",
				domainEndDateProperty: restValues?.domainEndDateProperty || "",
				domainPropertyToDisplay: restValues?.domainPropertyToDisplay || ""
			}
		};
		const newTransactionType = {
			...restValues,
			domainFields: domainFieldsDict,
			pageConfiguration
		};
		try {
			if ((await postCreateTransactionType(newTransactionType))?.status === 201) enqueueSnackbar(t("TransactionType created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleSideSheet(false);
			setSelectedDomainName("");
			gridApiRef.current?.refreshServerSide();
		} catch (err) {
			enqueueSnackbar(typeof err.response.data === "object" ? err.response.data.title : err.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		catalogObjectProperties,
		enqueueSnackbar,
		handleSideSheet,
		successAction,
		t
	]);
	const handleUpdateTransactionType = useCallback(async (formValues_0, initialValues) => {
		const { domainFields: domainFields_0, ...restValues_0 } = formValues_0;
		const transactionTypeId_3 = initialValues.transactionTypeId;
		const { pageConfigurationColumnDefsDict: pageConfigurationColumnDefsDict_0, domainFieldsDict: domainFieldsDict_0 } = (Array.isArray(domainFields_0) ? domainFields_0 : []).reduce((accumulator_0, entry_0) => {
			if (!entry_0 || !entry_0[0]) return accumulator_0;
			const field_0 = entry_0[0];
			let fieldKey_0 = field_0;
			if (catalogObjectProperties.includes(fieldKey_0)) fieldKey_0 = `${UdpSearchEnums.UdpBusinessDomainPrefix}_${fieldKey_0}`;
			const config_0 = entry_0[1] || {};
			const displayName_0 = config_0.displayName || field_0;
			const order_0 = config_0.order || 0;
			const hide_0 = config_0.hide || false;
			accumulator_0.pageConfigurationColumnDefsDict[fieldKey_0] = {
				displayName: displayName_0,
				order: order_0,
				hide: hide_0
			};
			if (!REQUIRED_COLUMN_DEF_FIELDS.includes(field_0)) accumulator_0.domainFieldsDict[field_0] = {
				displayName: displayName_0,
				order: order_0,
				hide: hide_0
			};
			return accumulator_0;
		}, {
			pageConfigurationColumnDefsDict: {},
			domainFieldsDict: {}
		});
		const pageConfiguration_0 = {
			gridTitle: restValues_0?.gridTitle || "",
			createTransactionButtonLabel: restValues_0?.createTransactionButtonLabel || "",
			hideCreateTransaction: restValues_0?.hideCreateTransaction,
			paginationAutoPageSize: restValues_0?.paginationAutoPageSize,
			hideSaveChanges: restValues_0?.hideSaveChanges,
			columnDefProperties: pageConfigurationColumnDefsDict_0,
			calendarViewConfiguration: {
				enabled: !!restValues_0?.calendarViewEnabled,
				isDefaultView: !!restValues_0?.calendarViewEnabled && !!restValues_0?.isDefaultView,
				defaultCalendarViewType: restValues_0?.defaultCalendarViewType || "",
				domainStartDateProperty: restValues_0?.domainStartDateProperty || "",
				domainEndDateProperty: restValues_0?.domainEndDateProperty || "",
				domainPropertyToDisplay: restValues_0?.domainPropertyToDisplay || ""
			}
		};
		const updatedTransactionType = {
			...initialValues,
			...formValues_0,
			domainFields: domainFieldsDict_0,
			pageConfiguration: pageConfiguration_0
		};
		try {
			if ((await putUpdateTransactionType(transactionTypeId_3, updatedTransactionType)).status === 204) enqueueSnackbar(t("TransactionType updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleSideSheet(false);
			setSelectedDomainName("");
			gridApiRef.current?.refreshServerSide();
		} catch (err_0) {
			enqueueSnackbar(typeof err_0.response.data === "object" ? err_0.response.data.title : err_0.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		catalogObjectProperties,
		enqueueSnackbar,
		handleSideSheet,
		successAction,
		t
	]);
	const handleDeleteTransactionType = useCallback(async () => {
		if (!selectedTransactionType) return;
		setIsTransactionTypeSidesheetLoading(true);
		const transactionTypeId_4 = selectedTransactionType.transactionTypeId;
		try {
			if ((await deleteTransactionType(transactionTypeId_4)).status === 204) enqueueSnackbar(t("TransactionType deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionTypeDialogOpen(false);
			gridApiRef.current?.refreshServerSide();
		} catch (err_1) {
			enqueueSnackbar(typeof err_1.response.data === "object" ? err_1.response.data.title : err_1.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		} finally {
			setIsTransactionTypeSidesheetLoading(false);
		}
	}, [
		enqueueSnackbar,
		selectedTransactionType,
		successAction,
		t,
		setIsTransactionTypeSidesheetLoading,
		setIsDeleteTransactionTypeDialogOpen
	]);
	/** end of TransactionType */
	/** TransactionTypeStatus */
	const handleCreateTransactionTypeStatus = useCallback(async (formValues_1) => {
		const newTransactionTypeStatus = {
			...formValues_1,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			color: formValues_1?.color?.value || null
		};
		let hasDefaultOrCancelledStatus = false;
		try {
			const isCreatingDefaultStatus = formValues_1?.isDefault === true;
			const isCreatingCancelledStatus = formValues_1?.isCancelledStatus === true;
			if (isCreatingDefaultStatus || isCreatingCancelledStatus) {
				const searchTransactionTypeStatusResponse = await searchTransactionTypeStatusByTransactionTypeId(selectedTransactionType?.transactionTypeId);
				if (searchTransactionTypeStatusResponse?.status !== 200) {
					enqueueSnackbar(t("Unable to validate existing TransactionTypeStatus records. Please try again."), {
						variant: "error",
						anchorOrigin: {
							vertical: "top",
							horizontal: "center"
						}
					});
					return;
				}
				hasDefaultOrCancelledStatus = hasDefaultAndCancelledTransactionTypeStatus(searchTransactionTypeStatusResponse?.data?.pageList, isCreatingDefaultStatus, isCreatingCancelledStatus);
			}
			if ((isCreatingDefaultStatus || isCreatingCancelledStatus) && hasDefaultOrCancelledStatus) {
				let statusConflictMessage = "";
				if (isCreatingDefaultStatus) statusConflictMessage = "There is already a TransactionTypeStatus for this TransactionType that has IsDefault set to true.";
				else if (isCreatingCancelledStatus) statusConflictMessage = "There is already a TransactionTypeStatus for this TransactionType that has IsCancelledStatus set to true.";
				enqueueSnackbar(t(statusConflictMessage), {
					variant: "error",
					anchorOrigin: {
						vertical: "top",
						horizontal: "center"
					}
				});
				return;
			}
			if ((await postCreateTransactionTypeStatus(newTransactionTypeStatus))?.status === 201) enqueueSnackbar(t("TransactionTypeStatus created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeStatusSideSheet(false);
			ttsGridApiRef.current?.refreshServerSide();
		} catch (err_2) {
			enqueueSnackbar(typeof err_2.response?.data === "object" ? err_2.response.data.title : err_2.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttsGridApiRef,
		handleCreateOrEditTransactionTypeStatusSideSheet,
		successAction,
		t,
		selectedTransactionType,
		searchTransactionTypeStatusByTransactionTypeId,
		hasDefaultAndCancelledTransactionTypeStatus
	]);
	const handleUpdateTransactionTypeStatus = useCallback(async (formValues_2, initialValues_0) => {
		const transactionTypeStatusId_1 = initialValues_0.transactionTypeStatusId;
		const updatedTransactionTypeStatus = {
			...initialValues_0,
			...formValues_2,
			color: formValues_2?.color?.value || null
		};
		let hasExistingDefaultOrCancelledStatus = false;
		try {
			const isEditingDefaultStatus = formValues_2?.isDefault === true;
			const isEditingCancelledStatus = formValues_2?.isCancelledStatus === true;
			if (isEditingDefaultStatus || isEditingCancelledStatus) {
				const searchTransactionTypeStatusResponse_0 = await searchTransactionTypeStatusByTransactionTypeId(selectedTransactionType?.transactionTypeId);
				if (searchTransactionTypeStatusResponse_0?.status !== 200) {
					enqueueSnackbar(t("Unable to validate existing TransactionTypeStatus records. Please try again."), {
						variant: "error",
						anchorOrigin: {
							vertical: "top",
							horizontal: "center"
						}
					});
					return;
				}
				hasExistingDefaultOrCancelledStatus = hasDefaultAndCancelledTransactionTypeStatus(searchTransactionTypeStatusResponse_0?.data?.pageList, isEditingDefaultStatus, isEditingCancelledStatus);
			}
			if ((isEditingDefaultStatus || isEditingCancelledStatus) && hasExistingDefaultOrCancelledStatus) {
				enqueueSnackbar(t(`There is already a TransactionTypeStatus for this TransactionType that has
              ${isEditingDefaultStatus ? isEditingCancelledStatus ? "IsDefault and/or IsCancelledStatus" : "IsDefault" : "IsCancelledStatus"} set to true.`), {
					variant: "error",
					anchorOrigin: {
						vertical: "top",
						horizontal: "center"
					}
				});
				return;
			}
			if ((await putUpdateTransactionTypeStatus(transactionTypeStatusId_1, updatedTransactionTypeStatus)).status === 204) enqueueSnackbar(t("TransactionTypeStatus updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeStatusSideSheet(false);
			ttsGridApiRef.current?.refreshServerSide();
		} catch (err_3) {
			enqueueSnackbar(typeof err_3.response?.data === "object" ? err_3.response.data.title : err_3.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttsGridApiRef,
		handleCreateOrEditTransactionTypeStatusSideSheet,
		successAction,
		t,
		searchTransactionTypeStatusByTransactionTypeId,
		hasDefaultAndCancelledTransactionTypeStatus,
		selectedTransactionType
	]);
	const handleDeleteTransactionTypeStatus = useCallback(async () => {
		if (!selectedTransactionTypeStatus) return;
		const transactionTypeStatusId_2 = selectedTransactionTypeStatus.transactionTypeStatusId;
		try {
			if ((await deleteTransactionTypeStatus(transactionTypeStatusId_2)).status === 204) enqueueSnackbar(t("TransactionTypeStatus deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionTypeStatusDialogOpen(false);
			ttsGridApiRef.current?.refreshServerSide();
		} catch (err_4) {
			enqueueSnackbar(typeof err_4.response.data === "object" ? err_4.response.data.title : err_4.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionTypeStatus,
		successAction,
		t,
		ttsGridApiRef,
		setIsDeleteTransactionTypeStatusDialogOpen
	]);
	/** end of TransactionTypeStatus */
	/** TransactionTypeTransactionAction */
	const handleCreateTransactionTypeTransactionAction = useCallback(async (formValues_3) => {
		const { transactionAction, toStatus, actionApiId, pageId, mandatoryFields, hiddenFields, domainDataToUpdate, ...restValues_1 } = formValues_3 || {};
		const domainDataDictionary = (Array.isArray(domainDataToUpdate) ? domainDataToUpdate : []).reduce((accumulator_1, entry_1) => {
			if (!entry_1) return accumulator_1;
			const [field_1, value] = entry_1;
			if (field_1) accumulator_1[field_1] = value;
			return accumulator_1;
		}, {});
		const newTransactionTypeTransactionAction = {
			...restValues_1,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionActionId: transactionAction?.transactionActionId,
			parameters: {
				ToStatus: toStatus?.transactionTypeStatusId,
				DomainDataToUpdate: domainDataDictionary,
				MandatoryFields: Array.isArray(mandatoryFields) ? mandatoryFields : [],
				HiddenFields: Array.isArray(hiddenFields) ? hiddenFields : [],
				ActionApiId: actionApiId?.actionApiId || "",
				PageId: pageId?.pageId || ""
			}
		};
		try {
			if ((await postCreateTransactionTypeTransactionAction(newTransactionTypeTransactionAction))?.status === 201) enqueueSnackbar(t("TransactionTypeTransactionAction created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeTransactionActionSidesheet(false);
			tttaGridApiRef.current?.refreshServerSide();
		} catch (err_5) {
			enqueueSnackbar(typeof err_5.response.data === "object" ? err_5.response.data.title : err_5.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		tttaGridApiRef,
		handleCreateOrEditTransactionTypeTransactionActionSidesheet,
		successAction,
		t,
		selectedTransactionType
	]);
	const handleUpdateTransactionTypeTransactionAction = useCallback(async (formValues_4, initialValues_1) => {
		const { transactionAction: transactionAction_0, toStatus: toStatus_0, actionApiId: actionApiId_0, pageId: pageId_0, mandatoryFields: mandatoryFields_0, hiddenFields: hiddenFields_0, domainDataToUpdate: domainDataToUpdate_0 } = formValues_4 || {};
		const transactionTypeTransactionActionId_3 = initialValues_1.transactionTypeTransactionActionId;
		const domainDataDictionary_0 = (Array.isArray(domainDataToUpdate_0) ? domainDataToUpdate_0 : []).reduce((accumulator_2, entry_2) => {
			if (!entry_2) return accumulator_2;
			const [field_2, value_0] = entry_2;
			if (field_2) accumulator_2[field_2] = value_0;
			return accumulator_2;
		}, {});
		const updatedTransactionTypeTransactionAction = {
			...initialValues_1,
			name: formValues_4?.name || "",
			description: formValues_4?.description || "",
			icon: formValues_4?.icon || "",
			transactionTypeTransactionActionId: transactionTypeTransactionActionId_3,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionActionId: transactionAction_0?.transactionActionId,
			parameters: {
				ToStatus: toStatus_0?.transactionTypeStatusId,
				DomainDataToUpdate: domainDataDictionary_0,
				MandatoryFields: Array.isArray(mandatoryFields_0) ? mandatoryFields_0 : [],
				HiddenFields: Array.isArray(hiddenFields_0) ? hiddenFields_0 : [],
				ActionApiId: actionApiId_0?.actionApiId || "",
				PageId: pageId_0?.pageId || ""
			}
		};
		try {
			if ((await putUpdateTransactionTypeTransactionAction(transactionTypeTransactionActionId_3, updatedTransactionTypeTransactionAction)).status === 204) enqueueSnackbar(t("TransactionTypeTransactionAction updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeTransactionActionSidesheet(false);
			tttaGridApiRef.current?.refreshServerSide();
		} catch (err_6) {
			enqueueSnackbar(typeof err_6.response.data === "object" ? err_6.response.data.title : err_6.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		tttaGridApiRef,
		handleCreateOrEditTransactionTypeTransactionActionSidesheet,
		successAction,
		t,
		selectedTransactionType
	]);
	const handleDeleteTransactionTypeTransactionAction = useCallback(async () => {
		if (!selectedTransactionTypeTransactionAction) return;
		const transactionTypeTransactionActionId_4 = selectedTransactionTypeTransactionAction.transactionTypeTransactionActionId;
		try {
			if ((await deleteTransactionTypeTransactionAction(transactionTypeTransactionActionId_4)).status === 204) enqueueSnackbar(t("TransactionTypeTransactionAction deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionTypeTransactionActionDialogOpen(false);
			tttaGridApiRef.current?.refreshServerSide();
		} catch (err_7) {
			enqueueSnackbar(typeof err_7.response.data === "object" ? err_7.response.data.title : err_7.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionTypeTransactionAction,
		successAction,
		t,
		setIsDeleteTransactionTypeTransactionActionDialogOpen
	]);
	/** end of TransactionTypeTransactionAction */
	/** TransactionUiAction */
	const handleCreateTransactionUiAction = useCallback(async (formValues_5) => {
		const { transactionUiActionType, actionApi, page, ...restValues_2 } = formValues_5;
		const newTransactionUiAction = {
			...restValues_2,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionUiActionTypeId: transactionUiActionType?.transactionUiActionTypeId,
			parameters: {
				ActionApiId: actionApi?.actionApiId || "",
				PageId: page?.pageId || ""
			}
		};
		try {
			if ((await postCreateTransactionUiAction(newTransactionUiAction))?.status === 201) enqueueSnackbar(t("TransactionUiAction created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionUiActionSidesheet(false);
			tuaGridApiRef.current?.refreshServerSide();
			fetchTUiActionsList();
		} catch (err_8) {
			enqueueSnackbar(typeof err_8.response.data === "object" ? err_8.response.data.title : err_8.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		tuaGridApiRef,
		handleCreateOrEditTransactionUiActionSidesheet,
		successAction,
		t,
		selectedTransactionType,
		fetchTUiActionsList
	]);
	const handleUpdateTransactionUiAction = useCallback(async (formValues_6, initialValues_2) => {
		const { transactionUiActionType: transactionUiActionType_0, actionApi: actionApi_0, page: page_0, ...restValues_3 } = formValues_6;
		const transactionUiActionId_1 = initialValues_2.transactionUiActionId;
		const updatedTransactionUiAction = {
			...restValues_3,
			transactionUiActionId: transactionUiActionId_1,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionUiActionTypeId: transactionUiActionType_0?.transactionUiActionTypeId,
			parameters: {
				ActionApiId: actionApi_0?.actionApiId || "",
				PageId: page_0?.pageId || ""
			}
		};
		try {
			if ((await putUpdateTransactionUiAction(transactionUiActionId_1, updatedTransactionUiAction)).status === 204) enqueueSnackbar(t("TransactionUiAction updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionUiActionSidesheet(false);
			tuaGridApiRef.current?.refreshServerSide();
			fetchTUiActionsList();
		} catch (err_9) {
			enqueueSnackbar(typeof err_9.response.data === "object" ? err_9.response.data.title : err_9.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		tuaGridApiRef,
		handleCreateOrEditTransactionUiActionSidesheet,
		successAction,
		t,
		selectedTransactionType,
		fetchTUiActionsList
	]);
	const handleDeleteTransactionUiAction = useCallback(async () => {
		if (!selectedTransactionUiAction) return;
		const transactionUiActionId_2 = selectedTransactionUiAction.transactionUiActionId;
		try {
			if ((await deleteTransactionUiAction(transactionUiActionId_2)).status === 204) enqueueSnackbar(t("TransactionUiAction deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionUiActionDialogOpen(false);
			tuaGridApiRef.current?.refreshServerSide();
			fetchTUiActionsList();
		} catch (err_10) {
			enqueueSnackbar(typeof err_10.response.data === "object" ? err_10.response.data.title : err_10.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionUiAction,
		successAction,
		t,
		setIsDeleteTransactionUiActionDialogOpen,
		fetchTUiActionsList
	]);
	/** end of TransactionUiAction */
	/** TransactionTypeConfiguration */
	const handleCreateTransactionTypeConfiguration = useCallback(async (formValues_7) => {
		const { transactionRuleType, currentStatus, tenantUserRoles, currentDomainValue, ...restValues_4 } = formValues_7;
		const domainDataDictionary_1 = (Array.isArray(currentDomainValue) ? currentDomainValue : []).reduce((accumulator_3, entry_3) => {
			if (!entry_3) return accumulator_3;
			const field_3 = entry_3[0];
			const value_1 = entry_3[1].value;
			const operator = entry_3[1]?.operator?.value;
			if (field_3) accumulator_3[field_3] = {
				value: value_1,
				operator
			};
			return accumulator_3;
		}, {});
		const tenantUserRoleIds = tenantUserRoles?.map((tur) => tur?.roleId);
		const configurationObj = {
			CurrentStatus: currentStatus,
			CurrentDomainValue: domainDataDictionary_1,
			TenantUserRoleIds: Array.isArray(tenantUserRoleIds) ? tenantUserRoleIds : []
		};
		const expressionLogic = formatTransactionTypeConfigurationIntoExpressionLogic(configurationObj);
		const newTransactionTypeConfiguration = {
			...restValues_4,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionRuleTypeId: transactionRuleType?.transactionRuleTypeId,
			configuration: {
				...configurationObj,
				CurrentStatusId: currentStatus?.transactionTypeStatusId
			},
			expressionLogic
		};
		try {
			if ((await postCreateTransactionTypeConfiguration(newTransactionTypeConfiguration))?.status === 201) enqueueSnackbar(t("TransactionTypeConfiguration created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeConfigurationSidesheet(false);
			ttcGridApiRef.current?.refreshServerSide();
		} catch (err_11) {
			enqueueSnackbar(typeof err_11.response.data === "object" ? err_11.response.data.title : err_11.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttcGridApiRef,
		handleCreateOrEditTransactionTypeConfigurationSidesheet,
		successAction,
		t,
		selectedTransactionType
	]);
	const handleUpdateTransactionTypeConfiguration = useCallback(async (formValues_8, initialValues_3) => {
		const { transactionRuleType: transactionRuleType_0, currentStatus: currentStatus_0, tenantUserRoles: tenantUserRoles_0, currentDomainValue: currentDomainValue_0, name, ...restValues_5 } = formValues_8;
		const transactionTypeConfigurationId_3 = initialValues_3.transactionTypeConfigurationId;
		const domainDataDictionary_2 = (Array.isArray(currentDomainValue_0) ? currentDomainValue_0 : []).reduce((accumulator_4, entry_4) => {
			if (!entry_4) return accumulator_4;
			const field_4 = entry_4[0];
			const value_2 = entry_4[1].value;
			const operator_0 = entry_4[1]?.operator?.value;
			if (field_4) accumulator_4[field_4] = {
				value: value_2,
				operator: operator_0
			};
			return accumulator_4;
		}, {});
		const tenantUserRoleIds_0 = tenantUserRoles_0?.map((tur_0) => tur_0?.roleId);
		const configurationObj_0 = {
			CurrentStatus: currentStatus_0,
			CurrentDomainValue: domainDataDictionary_2,
			TenantUserRoleIds: Array.isArray(tenantUserRoleIds_0) ? tenantUserRoleIds_0 : []
		};
		const expressionLogic_0 = formatTransactionTypeConfigurationIntoExpressionLogic(configurationObj_0);
		const updatedTransactionTypeConfiguration = {
			...initialValues_3,
			name: name || "",
			order: formValues_8?.order || 0,
			enabled: formValues_8?.enabled,
			transactionTypeConfigurationId: transactionTypeConfigurationId_3,
			transactionTypeId: selectedTransactionType?.transactionTypeId,
			transactionRuleTypeId: transactionRuleType_0?.transactionRuleTypeId,
			configuration: {
				...configurationObj_0,
				CurrentStatusId: currentStatus_0?.transactionTypeStatusId
			},
			expressionLogic: expressionLogic_0
		};
		try {
			if ((await putUpdateTransactionTypeConfiguration(transactionTypeConfigurationId_3, updatedTransactionTypeConfiguration)).status === 204) enqueueSnackbar(t("TransactionTypeConfiguration updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeConfigurationSidesheet(false);
			ttcGridApiRef.current?.refreshServerSide();
		} catch (err_12) {
			enqueueSnackbar(typeof err_12.response.data === "object" ? err_12.response.data.title : err_12.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttcGridApiRef,
		handleCreateOrEditTransactionTypeConfigurationSidesheet,
		successAction,
		t,
		selectedTransactionType
	]);
	const handleDeleteTransactionTypeConfiguration = useCallback(async () => {
		if (!selectedTransactionTypeConfiguration) return;
		const transactionTypeConfigurationId_4 = selectedTransactionTypeConfiguration.transactionTypeConfigurationId;
		try {
			if ((await deleteTransactionTypeConfiguration(transactionTypeConfigurationId_4)).status === 204) enqueueSnackbar(t("TransactionTypeConfiguration deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionTypeConfigurationDialogOpen(false);
			ttcGridApiRef.current?.refreshServerSide();
		} catch (err_13) {
			enqueueSnackbar(typeof err_13.response.data === "object" ? err_13.response.data.title : err_13.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionTypeConfiguration,
		successAction,
		t,
		setIsDeleteTransactionTypeConfigurationDialogOpen
	]);
	/** end of TransactionTypeConfiguration */
	/** TransactionTypeConfigurationTransactionAction */
	const handleCreateTransactionTypeConfigurationTransactionAction = useCallback(async (formValues_9) => {
		const { transactionTypeTransactionActions } = formValues_9;
		const newTTCTActions = [];
		transactionTypeTransactionActions?.forEach((action) => {
			newTTCTActions.push({
				transactionTypeConfigurationId: selectedTransactionTypeConfiguration?.transactionTypeConfigurationId,
				transactionTypeTransactionActionId: action?.transactionTypeTransactionActionId
			});
		});
		try {
			if ((await postCreateTransactionTypeConfigurationTransactionAction(newTTCTActions))?.status === 201) enqueueSnackbar(t("TransactionTypeConfigurationTransactionAction(s) created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet(false);
			ttctaGridApiRef.current?.refreshServerSide();
			fetchTtctaList();
		} catch (err_14) {
			enqueueSnackbar(typeof err_14.response.data === "object" ? err_14.response.data.title : err_14.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttctaGridApiRef,
		handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet,
		successAction,
		t,
		selectedTransactionTypeConfiguration,
		fetchTtctaList
	]);
	const handleUpdateTransactionTypeConfigurationTransactionAction = useCallback(async (formValues_10, initialValues_4) => {
		const { transactionTypeTransactionActions: transactionTypeTransactionActions_0 } = formValues_10;
		const transactionTypeConfigurationId_5 = selectedTransactionTypeConfiguration?.transactionTypeConfigurationId;
		const existingTransactionTypeTransactionActionId = initialValues_4?.transactionTypeTransactionActionId;
		const updatedTransactionTypeConfigurationTransactionAction = {
			transactionTypeConfigurationId: transactionTypeConfigurationId_5,
			transactionTypeTransactionActionId: transactionTypeTransactionActions_0?.[0]?.transactionTypeTransactionActionId
		};
		try {
			if ((await putUpdateTransactionTypeConfigurationTransactionAction(transactionTypeConfigurationId_5, existingTransactionTypeTransactionActionId, updatedTransactionTypeConfigurationTransactionAction)).status === 204) enqueueSnackbar(t("TransactionTypeConfigurationTransactionAction updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet(false);
			ttctaGridApiRef.current?.refreshServerSide();
			fetchTtctaList();
		} catch (err_15) {
			enqueueSnackbar(typeof err_15.response.data === "object" ? err_15.response.data.title : err_15.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		ttctaGridApiRef,
		handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet,
		successAction,
		t,
		selectedTransactionTypeConfiguration,
		fetchTtctaList
	]);
	const handleDeleteTransactionTypeConfigurationTransactionAction = useCallback(async () => {
		if (!selectedTransactionTypeConfigurationTransactionAction) return;
		const transactionTypeConfigurationId_6 = selectedTransactionTypeConfigurationTransactionAction?.transactionTypeConfigurationId;
		const transactionTypeTransactionActionId_5 = selectedTransactionTypeConfigurationTransactionAction?.transactionTypeTransactionActionId;
		try {
			if ((await deleteTransactionTypeConfigurationTransactionAction(transactionTypeConfigurationId_6, transactionTypeTransactionActionId_5)).status === 204) enqueueSnackbar(t("TransactionTypeConfigurationTransactionAction deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionTypeConfigurationTransactionActionDialogOpen(false);
			ttctaGridApiRef.current?.refreshServerSide();
			fetchTtctaList();
		} catch (err_16) {
			enqueueSnackbar(typeof err_16.response.data === "object" ? err_16.response.data.title : err_16.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		ttctaGridApiRef,
		enqueueSnackbar,
		selectedTransactionTypeConfigurationTransactionAction,
		successAction,
		t,
		setIsDeleteTransactionTypeConfigurationTransactionActionDialogOpen,
		fetchTtctaList
	]);
	/** end of TransactionTypeConfigurationTransactionAction */
	/** TransactionAttachmentType */
	const handleCreateTransactionAttachmentType = useCallback(async (formValues_11) => {
		const newTransactionAttachmentType = {
			...formValues_11,
			transactionTypeId: selectedTransactionType?.transactionTypeId
		};
		try {
			if ((await postCreateTransactionAttachmentType(newTransactionAttachmentType))?.status === 201) enqueueSnackbar(t("TransactionAttachmentType created successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionAttachmentTypeSidesheet(false);
			tatGridApiRef.current?.refreshServerSide();
		} catch (err_17) {
			enqueueSnackbar(typeof err_17.response.data === "object" ? err_17.response.data.title : err_17.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		tatGridApiRef,
		successAction,
		t,
		selectedTransactionType,
		handleCreateOrEditTransactionAttachmentTypeSidesheet
	]);
	const handleUpdateTransactionAttachmentType = useCallback(async (formValues_12, initialValues_5) => {
		const transactionTypeId_5 = selectedTransactionType?.transactionTypeId;
		const transactionAttachmentTypeId_1 = selectedTransactionAttachmentType?.transactionAttachmentTypeId;
		const updatedTransactionType_0 = {
			...initialValues_5,
			...formValues_12,
			transactionTypeId: transactionTypeId_5,
			transactionAttachmentTypeId: transactionAttachmentTypeId_1
		};
		try {
			if ((await putUpdateTransactionAttachmentType(transactionAttachmentTypeId_1, updatedTransactionType_0)).status === 204) enqueueSnackbar(t("TransactionAttachmentType updated successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			handleCreateOrEditTransactionAttachmentTypeSidesheet(false);
			tatGridApiRef.current?.refreshServerSide();
		} catch (err_18) {
			enqueueSnackbar(typeof err_18.response.data === "object" ? err_18.response.data.title : err_18.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionType,
		successAction,
		t
	]);
	const handleDeleteTransactionAttachmentType = useCallback(async () => {
		if (!selectedTransactionAttachmentType) return;
		const transactionAttachmentTypeId_2 = selectedTransactionAttachmentType?.transactionAttachmentTypeId;
		try {
			if ((await deleteTransactionAttachmentType(transactionAttachmentTypeId_2)).status === 204) enqueueSnackbar(t("TransactionAttachmentType deleted successfully"), {
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				},
				action: successAction
			});
			setIsDeleteTransactionAttachmentTypeDialogOpen(false);
			tatGridApiRef.current?.refreshServerSide();
		} catch (err_19) {
			enqueueSnackbar(typeof err_19.response.data === "object" ? err_19.response.data.title : err_19.response.data, {
				variant: "error",
				anchorOrigin: {
					vertical: "top",
					horizontal: "center"
				}
			});
		}
	}, [
		enqueueSnackbar,
		selectedTransactionAttachmentType,
		tatGridApiRef,
		successAction,
		t,
		setIsDeleteTransactionAttachmentTypeDialogOpen
	]);
	/** end of TransactionAttachmentType */
	const handleOpenDeleteTransactionTypeDialog = useCallback((transactionType_7) => {
		setSelectedTransactionType(transactionType_7);
		setIsDeleteTransactionTypeDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionTypeDialog = useCallback(() => {
		setIsDeleteTransactionTypeDialogOpen(false);
		setSelectedTransactionType(null);
	}, []);
	const handleOpenDeleteTransactionTypeStatusDialog = useCallback((transactionTypeStatus_2) => {
		setSelectedTransactionTypeStatus(transactionTypeStatus_2);
		setIsDeleteTransactionTypeStatusDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionTypeStatusDialog = useCallback(() => {
		setIsDeleteTransactionTypeStatusDialogOpen(false);
		setSelectedTransactionTypeStatus(null);
	}, []);
	const handleOpenDeleteTransactionTypeTransactionActionDialog = useCallback((transactionTypeTransactionAction_2) => {
		setSelectedTransactionTypeTransactionAction(transactionTypeTransactionAction_2);
		setIsDeleteTransactionTypeTransactionActionDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionTypeTransactionActionDialog = useCallback(() => {
		setIsDeleteTransactionTypeTransactionActionDialogOpen(false);
		setSelectedTransactionTypeTransactionAction(null);
	}, []);
	const handleOpenDeleteTransactionUiActionDialog = useCallback((transactionUiAction_2) => {
		setSelectedTransactionUiAction(transactionUiAction_2);
		setIsDeleteTransactionUiActionDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionUiActionDialog = useCallback(() => {
		setIsDeleteTransactionUiActionDialogOpen(false);
		setSelectedTransactionUiAction(null);
	}, []);
	const handleOpenDeleteTransactionTypeConfigurationDialog = useCallback((transactionTypeConfiguration_3) => {
		setSelectedTransactionTypeConfiguration(transactionTypeConfiguration_3);
		setIsDeleteTransactionTypeConfigurationDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionTypeConfigurationDialog = useCallback(() => {
		setIsDeleteTransactionTypeConfigurationDialogOpen(false);
		setSelectedTransactionTypeConfiguration(null);
	}, []);
	const handleOpenDeleteTransactionTypeConfigurationTransactionActionDialog = useCallback((transactionTypeConfigurationTransactionAction_1) => {
		setSelectedTransactionTypeConfigurationTransactionAction(transactionTypeConfigurationTransactionAction_1);
		setIsDeleteTransactionTypeConfigurationTransactionActionDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionTypeConfigurationTransactionActionDialog = useCallback(() => {
		setIsDeleteTransactionTypeConfigurationTransactionActionDialogOpen(false);
		setSelectedTransactionTypeConfigurationTransactionAction(null);
	}, []);
	const handleOpenDeleteTransactionAttachmentTypeDialog = useCallback((transactionAttachmentType_2) => {
		setSelectedTransactionAttachmentType(transactionAttachmentType_2);
		setIsDeleteTransactionAttachmentTypeDialogOpen(true);
	}, []);
	const handleCloseDeleteTransactionAttachmentTypeDialog = useCallback(() => {
		setIsDeleteTransactionAttachmentTypeDialogOpen(false);
		setSelectedTransactionAttachmentType(null);
	}, []);
	const columnDefs = useMemo(() => {
		return [
			{
				headerName: t("Transaction Type ID"),
				field: "transactionTypeId",
				resizable: true,
				sortable: false,
				hide: true
			},
			{
				headerName: t("Name"),
				field: "name",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Domain Name"),
				field: "domainName",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Domain Fields"),
				field: "domainFields",
				resizable: true,
				sortable: false,
				hide: true
			},
			{
				headerName: t("Allow Revisions"),
				field: "hasRevision",
				resizable: true,
				sortable: false,
				cellDataType: "boolean"
			},
			{
				headerName: t("Revision Field"),
				field: "revisionField",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Enabled"),
				field: "enabled",
				resizable: true,
				sortable: false,
				cellDataType: "boolean"
			},
			{
				headerName: t("Archived on Cancel"),
				field: "archiveOnCancel",
				resizable: true,
				sortable: false,
				cellDataType: "boolean"
			},
			{
				headerName: t("Field Label"),
				field: "domainFieldLabel",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Sub-Type"),
				field: "domainFieldType",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Sub-Type Value"),
				field: "domainFieldValue",
				resizable: true,
				sortable: false
			},
			{
				headerName: t("Actions"),
				field: "actions",
				cellRenderer: "actionsRenderer",
				cellRendererParams: { actionList: [
					{
						id: 0,
						title: t("Edit"),
						iconName: "edit",
						handleOnClick: (e, transactionType_8) => {
							handleSideSheet(true, transactionType_8?.data);
						}
					},
					{
						id: 1,
						title: t("Delete"),
						iconName: "trashCan",
						handleOnClick: (e_0, transactionType_9) => {
							handleOpenDeleteTransactionTypeDialog(transactionType_9?.data);
						}
					},
					{
						id: 2,
						title: t("Manage Statuses"),
						iconName: "settings",
						handleOnClick: (e_1, transactionType_10) => {
							handleTransactionTypeStatusSideSheet(true, transactionType_10?.data);
						}
					},
					{
						id: 3,
						title: t("Manage Actions"),
						iconName: "text-grammar-settings",
						handleOnClick: (e_2, transactionType_11) => {
							handleTransactionTypeTransactionActionSidesheet(true, transactionType_11?.data);
						}
					},
					{
						id: 4,
						title: t("Manage Forms/Pages"),
						iconName: "form-new",
						handleOnClick: (e_3, transactionType_12) => {
							handleTransactionUiActionSidesheet(true, transactionType_12?.data);
						}
					},
					{
						id: 5,
						title: t("Manage Rules"),
						iconName: "apps-list",
						handleOnClick: (e_4, transactionType_13) => {
							handleTransactionTypeConfigurationSidesheet(true, transactionType_13?.data);
						}
					},
					{
						id: 6,
						title: t("Manage Attachment Types"),
						iconName: "attachment",
						handleOnClick: (e_5, transactionType_14) => {
							handleTransactionAttachmentTypeSidesheet(true, transactionType_14?.data);
						}
					}
				] },
				valueGetter: (params) => params.data,
				suppressMenu: true,
				sortable: false,
				filter: false
			}
		];
	}, [
		handleSideSheet,
		handleOpenDeleteTransactionTypeDialog,
		handleTransactionTypeStatusSideSheet,
		handleTransactionTypeTransactionActionSidesheet,
		handleTransactionUiActionSidesheet,
		handleTransactionTypeConfigurationSidesheet,
		handleTransactionAttachmentTypeSidesheet,
		t
	]);
	const headerConfig = {
		title: t("Transaction Types"),
		primaryActionButton: {
			label: t("Add"),
			iconName: "add",
			onClick: () => handleSideSheet(true)
		}
	};
	const gridFunctions = [
		{ name: "agGridExport" },
		{ name: "agGridSizeColumnsToFit" },
		{ name: "agGridAutoSizeColumns" },
		{ name: "agGridResetColumns" },
		{ name: "agGridHideShowColumns" }
	];
	const gridOptions = useMemo(() => {
		return { pagination: true };
	}, []);
	const handleGridApiCallback = (api) => {
		gridApiRef.current = api;
	};
	const searchMethodConfig = useMemo(() => {
		return {
			requestUrl: `${ConfigService.productV1ApiUrl}/UdpTransactionType/search`,
			customSearchObject: searchObject
		};
	}, [searchObject]);
	return /* @__PURE__ */ React.createElement(React.Fragment, null, isTransactionTypeSidesheetLoading && /* @__PURE__ */ React.createElement(LinearProgress$1, {
		className: classes.loadingBar,
		color: "secondary"
	}), /* @__PURE__ */ React.createElement(SearchMethodUdpGrid, {
		searchMethodConfig,
		columnDefs,
		gridHeaderConfig: headerConfig,
		gridOptions,
		gridApiCallback: handleGridApiCallback,
		gridFunctions
	}), /* @__PURE__ */ React.createElement(UdpTransactionTypeSidesheet, {
		key: selectedTransactionType?.transactionTypeId,
		initialTransactionType: selectedTransactionType,
		selectedDomainName,
		isSideSheetOpen: isTransactionTypeSideSheetOpen,
		handleSideSheet,
		setSelectedDomainName,
		handleCreateTransactionType,
		handleUpdateTransactionType,
		catalogObjectNames,
		catalogObjectProperties,
		catalogObjectDateProperties,
		isPageConfigurationSidesheetOpen,
		setIsPageConfigurationSidesheetOpen,
		isCalendarViewConfigurationSidesheetOpen,
		setIsCalendarViewConfigurationSidesheetOpen
	}), getTransactionsByTransactionIdLoading ? /* @__PURE__ */ React.createElement(LinearProgress$1, null) : /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionTypeDialogOpen,
		onClose: handleCloseDeleteTransactionTypeDialog,
		title: t("Confirm Delete"),
		message: !transactionsByTransactionTypeId?.pageList?.length ? t(`Are you sure you want to delete this type?`) : t(`Unable to delete this type as there are existing transactions associated with it.
              As an alternative, you can disable the type to prevent further use.`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionType,
		buttonOneHidden: !!transactionsByTransactionTypeId?.pageList?.length,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionTypeDialog
	}), /* @__PURE__ */ React.createElement(UdpTransactionTypeStatusSidesheet_default, {
		ref: ttsGridApiRef,
		transactionType: selectedTransactionType,
		transactionTypeStatus: selectedTransactionTypeStatus,
		isSideSheetOpen: isTransactionTypeStatusSidesheetOpen,
		isTransactionTypeStatusCreateOrEditSidesheetOpen: isCreateOrEditTransactionTypeStatusSidesheetOpen,
		handleTransactionTypeStatusSideSheet,
		handleCreateOrEditTransactionTypeStatusSideSheet,
		handleCreateTransactionTypeStatus,
		handleUpdateTransactionTypeStatus,
		handleDeleteTransactionTypeStatus: handleOpenDeleteTransactionTypeStatusDialog
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionTypeStatusDialogOpen,
		onClose: handleCloseDeleteTransactionTypeStatusDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this status?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionTypeStatus,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionTypeStatusDialog
	}), /* @__PURE__ */ React.createElement(UdpTransactionTypeTransactionActionSidesheet_default, {
		ref: tttaGridApiRef,
		transactionType: selectedTransactionType,
		transactionTypeTransactionAction: selectedTransactionTypeTransactionAction,
		isSideSheetOpen: isTransactionTypeTransactionActionSidesheetOpen,
		isTransactionTypeTransactionActionCreateOrEditSidesheetOpen: isCreateOrEditTransactionTypeTransactionActionSidesheetOpen,
		handleTransactionTypeTransactionActionSidesheet,
		handleCreateOrEditTransactionTypeTransactionActionSidesheet,
		handleCreateTransactionTypeTransactionAction,
		handleUpdateTransactionTypeTransactionAction,
		handleDeleteTransactionTypeTransactionAction: handleOpenDeleteTransactionTypeTransactionActionDialog,
		transactionActions,
		catalogObjectProperties,
		actionApis,
		pages,
		ttstatuses
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionTypeTransactionActionDialogOpen,
		onClose: handleCloseDeleteTransactionTypeTransactionActionDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this action?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionTypeTransactionAction,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionTypeTransactionActionDialog
	}), /* @__PURE__ */ React.createElement(UdpTransactionUiActionSidesheet_default, {
		ref: tuaGridApiRef,
		transactionType: selectedTransactionType,
		transactionUiAction: selectedTransactionUiAction,
		isSideSheetOpen: isTransactionUiActionSidesheetOpen,
		handleTransactionUiActionSidesheet,
		isCreateOrEditTransactionUiActionSidesheetOpen,
		handleCreateOrEditTransactionUiActionSidesheet,
		handleCreateTransactionUiAction,
		handleUpdateTransactionUiAction,
		handleDeleteTransactionUiAction: handleOpenDeleteTransactionUiActionDialog,
		transactionUiActionTypes,
		actionApis,
		pages,
		tUiActionsList
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionUiActionDialogOpen,
		onClose: handleCloseDeleteTransactionUiActionDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this UI action?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionUiAction,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionUiActionDialog
	}), /* @__PURE__ */ React.createElement(UdpTransactionTypeConfigurationSidesheet_default, {
		ref: ttcGridApiRef,
		transactionType: selectedTransactionType,
		transactionTypeConfiguration: selectedTransactionTypeConfiguration,
		isSideSheetOpen: isTransactionTypeConfigurationSidesheetOpen,
		handleTransactionTypeConfigurationSidesheet,
		isCreateOrEditTransactionTypeConfigurationSidesheetOpen,
		handleCreateOrEditTransactionTypeConfigurationSidesheet,
		handleCreateTransactionTypeConfiguration,
		handleUpdateTransactionTypeConfiguration,
		handleDeleteTransactionTypeConfiguration: handleOpenDeleteTransactionTypeConfigurationDialog,
		transactionRuleTypes,
		catalogObjectProperties,
		ttstatuses,
		roles,
		transactionTypeConfigurationTransactionAction: selectedTransactionTypeConfigurationTransactionAction,
		isTransactionTypeConfigurationTransactionActionSidesheetOpen,
		handleTransactionTypeConfigurationTransactionActionSidesheet,
		handleCreateOrEditTransactionTypeConfigurationTransactionActionSidesheet,
		isCreateOrEditTransactionTypeConfigurationTransactionActionSidesheetOpen,
		tttactions,
		handleCreateTransactionTypeConfigurationTransactionAction,
		handleUpdateTransactionTypeConfigurationTransactionAction,
		handleDeleteTransactionTypeConfigurationTransactionAction: handleOpenDeleteTransactionTypeConfigurationTransactionActionDialog,
		ttctaList,
		ttctaGridApiRef
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionTypeConfigurationDialogOpen,
		onClose: handleCloseDeleteTransactionTypeConfigurationDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this rule?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionTypeConfiguration,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionTypeConfigurationDialog
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionTypeConfigurationTransactionActionDialogOpen,
		onClose: handleCloseDeleteTransactionTypeConfigurationTransactionActionDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this linked action?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionTypeConfigurationTransactionAction,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionTypeConfigurationTransactionActionDialog
	}), /* @__PURE__ */ React.createElement(UdpTransactionAttachmentTypeSidesheet_default, {
		ref: tatGridApiRef,
		transactionType: selectedTransactionType,
		transactionAttachmentType: selectedTransactionAttachmentType,
		isSideSheetOpen: isTransactionAttachmentTypeSidesheetOpen,
		isTransactionAttachmentTypeCreateOrEditSidesheetOpen: isCreateOrEditTransactionAttachmentTypeSidesheetOpen,
		handleTransactionAttachmentTypeSidesheet,
		handleCreateOrEditTransactionAttachmentTypeSidesheet,
		handleCreateTransactionAttachmentType,
		handleUpdateTransactionAttachmentType,
		handleDeleteTransactionAttachmentType: handleOpenDeleteTransactionAttachmentTypeDialog
	}), /* @__PURE__ */ React.createElement(FluentDialog, {
		open: isDeleteTransactionAttachmentTypeDialogOpen,
		onClose: handleCloseDeleteTransactionAttachmentTypeDialog,
		title: t("Confirm Delete"),
		message: t(`Are you sure you want to delete this attachment type?`),
		labelOne: t("Delete"),
		actionOne: handleDeleteTransactionAttachmentType,
		labelTwo: t("Cancel"),
		actionTwo: handleCloseDeleteTransactionAttachmentTypeDialog
	}));
};
//#endregion
export { DISABLE_ORDERING_FOR_FIELDS, REQUIRED_COLUMN_DEF_FIELDS, REQUIRED_COLUMN_DEF_MAPPING, UdpTransactionTypesPage as default };

//# sourceMappingURL=UdpTransactionTypesPage.mjs.map