import useEngineContext from "../../../hooks/useEngineContext.js";
import { useEffect, useState } from "react";
//#region src/pro/comprehensiveSearch/hooks/useTerminalPeripherals.ts
const useTerminalPeripherals = (onChange) => {
	var _context$appHelper;
	const { interaction } = ((_context$appHelper = useEngineContext().appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {};
	const [peripheralsStatus, setPeripheralsStatus] = useState({
		scanner: "none",
		nfc: "none"
	});
	useEffect(() => {
		var _interaction$utils, _interaction$utils$po, _interaction$utils2, _interaction$utils2$m;
		interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
			module: "global",
			key: "get_peripherals_status",
			data: {}
		});
		interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$m = _interaction$utils2.mountFunction) === null || _interaction$utils2$m === void 0 || _interaction$utils2$m.call(_interaction$utils2, "global", "peripheralsStatus", (strPeripherals) => {
			try {
				setPeripheralsStatus(JSON.parse(strPeripherals));
			} catch (err) {
				console.error(err);
			}
		});
	}, []);
	return { peripheralsStatus };
};
//#endregion
export { useTerminalPeripherals as default };
