import { ClientEnum } from "../../const.js";
import { updateComponent, updateState, useContextData, useDispatch } from "../../store/index.js";
import payLog from "../../utils/payLog.js";
import header_default from "../header/index.js";
import React, { useEffect } from "react";
import { Button } from "antd";
import { locales } from "@pisell/utils";
import { useMount } from "ahooks";
//#region src/components/eftposPay/component/fail/unknow.tsx
/**
* @title: 支付状态未知页面
* @description:
* @Author: hongbing.wang
* @Date: 2024-08-20 11:42
*/
var unknow_default = ({ onChange, className = "" }) => {
	const { form, mode, client } = useContextData();
	const dispatch = useDispatch();
	useMount(() => {
		payLog.log("未知状态处理页展示");
	});
	/**
	* @title: 手动标记
	* @description: 前往手动标记
	* @Author: hongbing.wang
	* @Date: 2024-08-20 11:31
	*/
	const onManually = () => {
		payLog.log("未知状态处理页：点击手动标记");
		dispatch(updateState({ manual: {
			title: locales.getText("page.eftpos-pay.text.request.unknown.title")(mode),
			text: locales.getText("page.eftpos-pay.text.request.unknown.text")(mode)
		} }));
		dispatch(updateComponent("Manual"));
	};
	const onNotin = () => {
		payLog.log("未知状态处理页：点击打印小票");
		onChange("print", [], "print_on_timeout");
	};
	useEffect(() => {
		if (form === "Network" || form === "restore") {
			payLog.log("未知状态处理页：网络终端");
			dispatch(updateComponent(""));
		}
	}, [form]);
	return /* @__PURE__ */ React.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ React.createElement(header_default, { status: "warn" }), /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, locales.getText("page.eftpos-pay.text.unknown.title")(mode)), /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, client === ClientEnum.Merchant ? locales.getText("page.eftpos-pay.text.unknown.text")(mode) : locales.getText("page.eftpos-pay.text.transaction.eftpos.fail.other")), /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === ClientEnum.Merchant ? /* @__PURE__ */ React.createElement(Button, {
		block: true,
		className: "pisell-lowcode__eft-pay-step-item-btn",
		onClick: onManually
	}, locales.getText("page.eftpos-pay.text.manual.marking")) : /* @__PURE__ */ React.createElement(Button, {
		block: true,
		className: "pisell-lowcode__eft-pay-step-item-btn",
		onClick: onNotin
	}, locales.getText("page.eftpos-pay.text.manual.print_receipt"))));
};
//#endregion
export { unknow_default as default };
