/* eslint-disable no-nested-ternary */
import { locales } from '@pisell/utils';
import { Button } from 'antd';
import React, { useEffect } from 'react';
import { ClientEnum } from "../../const";
import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
import Header from "../header";

/**
 * @title: 支付状态未知页面
 * @description:
 * @Author: hongbing.wang
 * @Date: 2024-08-20 11:42
 */
export default (function (_ref) {
  var onChange = _ref.onChange,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? '' : _ref$className;
  var _useContextData = useContextData(),
    form = _useContextData.form,
    mode = _useContextData.mode,
    client = _useContextData.client;
  var dispatch = useDispatch();

  /**
   * @title: 手动标记
   * @description: 前往手动标记
   * @Author: hongbing.wang
   * @Date: 2024-08-20 11:31
   */
  var onManually = function onManually() {
    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'));
  };
  var onNotin = function onNotin() {
    onChange('print', [], 'print_on_timeout');
  };
  useEffect(function () {
    // 如果 网络终端 恢复至此页面 则需要 回归 步骤流程
    if (form === 'Network' || form === 'restore') {
      dispatch(updateComponent(''));
    }
  }, [form]);
  return /*#__PURE__*/React.createElement("div", {
    className: "pisell-lowcode__eft-pay-box ".concat(className)
  }, /*#__PURE__*/React.createElement(Header, {
    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'))));
});