@pisell/private-materials 3.0.187 → 3.0.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +3 -3
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/booking/info/utils.js +1 -1
  12. package/es/components/eftposPay/amount.d.ts +4 -3
  13. package/es/components/eftposPay/amount.js +5 -4
  14. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  15. package/es/components/eftposPay/component/fail/failCustom.js +14 -6
  16. package/es/components/eftposPay/component/fail/index.d.ts +1 -1
  17. package/es/components/eftposPay/component/fail/index.js +14 -5
  18. package/es/components/eftposPay/component/fail/unknow.d.ts +1 -1
  19. package/es/components/eftposPay/component/fail/unknow.js +17 -7
  20. package/es/components/eftposPay/const.d.ts +8 -2
  21. package/es/components/eftposPay/const.js +5 -0
  22. package/es/components/eftposPay/device.d.ts +4 -3
  23. package/es/components/eftposPay/device.js +5 -4
  24. package/es/components/eftposPay/hooks.d.ts +4 -3
  25. package/es/components/eftposPay/hooks.js +31 -6
  26. package/es/components/eftposPay/index.js +57 -23
  27. package/es/components/eftposPay/index.less +1 -0
  28. package/es/components/eftposPay/locales.d.ts +6 -0
  29. package/es/components/eftposPay/locales.js +6 -0
  30. package/es/components/eftposPay/pay.d.ts +3 -2
  31. package/es/components/eftposPay/pay.js +8 -7
  32. package/es/components/eftposPay/payo/config.d.ts +3 -1
  33. package/es/components/eftposPay/payo/config.js +11 -9
  34. package/es/components/eftposPay/payo/const.js +4 -2
  35. package/es/components/eftposPay/payo/index.js +3 -1
  36. package/es/components/eftposPay/store/index.d.ts +17 -2
  37. package/es/components/eftposPay/store/index.js +20 -0
  38. package/es/components/eftposPay/tyro/const.js +4 -2
  39. package/es/components/eftposPay/tyro/index.js +70 -20
  40. package/es/components/eftposPay/windcave/const.js +4 -2
  41. package/es/components/eftposPay/windcave/helper.js +19 -28
  42. package/es/components/eftposPay/windcave/windcave.js +2 -1
  43. package/lib/components/booking/info/utils.js +1 -1
  44. package/lib/components/eftposPay/amount.d.ts +4 -3
  45. package/lib/components/eftposPay/amount.js +4 -3
  46. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  47. package/lib/components/eftposPay/component/fail/failCustom.js +16 -4
  48. package/lib/components/eftposPay/component/fail/index.d.ts +1 -1
  49. package/lib/components/eftposPay/component/fail/index.js +17 -4
  50. package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -1
  51. package/lib/components/eftposPay/component/fail/unknow.js +15 -3
  52. package/lib/components/eftposPay/const.d.ts +8 -2
  53. package/lib/components/eftposPay/const.js +7 -0
  54. package/lib/components/eftposPay/device.d.ts +4 -3
  55. package/lib/components/eftposPay/device.js +5 -4
  56. package/lib/components/eftposPay/hooks.d.ts +4 -3
  57. package/lib/components/eftposPay/hooks.js +30 -8
  58. package/lib/components/eftposPay/index.js +46 -18
  59. package/lib/components/eftposPay/index.less +1 -0
  60. package/lib/components/eftposPay/locales.d.ts +6 -0
  61. package/lib/components/eftposPay/locales.js +6 -0
  62. package/lib/components/eftposPay/pay.d.ts +3 -2
  63. package/lib/components/eftposPay/pay.js +7 -6
  64. package/lib/components/eftposPay/payo/config.d.ts +3 -1
  65. package/lib/components/eftposPay/payo/config.js +8 -8
  66. package/lib/components/eftposPay/payo/const.js +2 -0
  67. package/lib/components/eftposPay/payo/index.js +1 -1
  68. package/lib/components/eftposPay/store/index.d.ts +17 -2
  69. package/lib/components/eftposPay/store/index.js +14 -0
  70. package/lib/components/eftposPay/tyro/const.js +2 -0
  71. package/lib/components/eftposPay/tyro/index.js +63 -6
  72. package/lib/components/eftposPay/windcave/const.js +2 -0
  73. package/lib/components/eftposPay/windcave/helper.js +23 -28
  74. package/lib/components/eftposPay/windcave/windcave.js +2 -1
  75. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net"];
2
+ var _excluded = ["order_id", "name", "symbol", "amount", "mode", "number", "pay", "device", "net", "client"];
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -8,7 +8,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { locales } from '@pisell/utils';
11
- import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum } from "../const";
11
+ import { EftposEnum, StatusEnum, PayRouteEnum, ModeEnum, ClientEnum } from "../const";
12
12
  /**
13
13
  * @title: 初始化 windcave 数据
14
14
  * @return store 全局数据管理
@@ -28,6 +28,7 @@ export default (function (params) {
28
28
  pay = _ref.pay,
29
29
  device = _ref.device,
30
30
  net = _ref.net,
31
+ client = _ref.client,
31
32
  other = _objectWithoutProperties(_ref, _excluded);
32
33
  return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
33
34
  order_id: order_id,
@@ -45,6 +46,7 @@ export default (function (params) {
45
46
  status: StatusEnum.Loading,
46
47
  steps: [],
47
48
  render: true,
49
+ client: client !== 'undefined' ? client : ClientEnum.Merchant,
48
50
  custom: other ? _objectSpread(_objectSpread({}, other), {}, {
49
51
  list: [],
50
52
  step: StepStatusEnum.Free
@@ -7,7 +7,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
7
7
  /* eslint-disable @typescript-eslint/no-unused-expressions */
8
8
  import { locales } from '@pisell/utils';
9
9
  import { useCallback, useEffect, useRef } from 'react';
10
- import { StatusEnum, PayStatus } from "../const";
10
+ import { StatusEnum, PayStatus, ClientEnum } from "../const";
11
11
  import { useContextData, useDispatch, updateComponent, updateState, updateStatus, updateCustom, updateKey } from "../store";
12
12
  import { StepStatusEnum, getStepMapping, StemTypeEnum } from "./const";
13
13
  import { useStoreRef } from "../hooks";
@@ -26,7 +26,8 @@ export var useFail = function useFail() {
26
26
  var _useContextData = useContextData(),
27
27
  custom = _useContextData.custom;
28
28
  var _useStoreRef = useStoreRef(),
29
- modeRef = _useStoreRef.modeRef;
29
+ modeRef = _useStoreRef.modeRef,
30
+ clientRef = _useStoreRef.clientRef;
30
31
  var ref = useRef((custom === null || custom === void 0 ? void 0 : custom.retry) || 0);
31
32
  useEffect(function () {
32
33
  ref.current = (custom === null || custom === void 0 ? void 0 : custom.retry) || 0;
@@ -103,6 +104,19 @@ export var useFail = function useFail() {
103
104
  }
104
105
  if (code === PayStatus.Timeout) {
105
106
  if (isMark) {
107
+ if (clientRef.current === ClientEnum.User) {
108
+ dispatch(updateCustom({
109
+ failCustom: {
110
+ isPosNetworkError: true,
111
+ status: 'warn',
112
+ fail: null,
113
+ title: locales.getText('page.eftpos-pay.text.timedout.title'),
114
+ warn: locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.other')
115
+ }
116
+ }));
117
+ dispatch(updateComponent('FailCustom'));
118
+ return;
119
+ }
106
120
  // 超时 前往标记页
107
121
  dispatch(updateState({
108
122
  manual: {
@@ -161,33 +175,9 @@ export var useFail = function useFail() {
161
175
  status: 'warn',
162
176
  fail: null,
163
177
  title: locales.getText('page.eftpos-pay.text.interrupted'),
164
- warn: "".concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.title'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.power'), "\n ").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.device'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.network'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.if')(modeRef.current), "\n ")
165
- // warn: (
166
- // <>
167
- // {locales.getText(
168
- // 'page.eftpos-pay.text.transaction.eftpos.fail.title'
169
- // )}
170
- // <br />
171
- // {locales.getText(
172
- // 'page.eftpos-pay.text.transaction.eftpos.fail.power'
173
- // )}
174
- // . <br />
175
- // {locales.getText(
176
- // 'page.eftpos-pay.text.transaction.eftpos.fail.device'
177
- // )}
178
- // <br />
179
- // {locales.getText(
180
- // 'page.eftpos-pay.text.transaction.eftpos.fail.network'
181
- // )}
182
- // <br />
183
- // {locales.getText(
184
- // 'page.eftpos-pay.text.transaction.eftpos.fail.if'
185
- // )(modeRef.current)}
186
- // </>
187
- // ),
178
+ warn: clientRef.current === ClientEnum.Merchant ? "".concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.title'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.power'), "\n ").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.device'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.network'), "\n").concat(locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.if')(modeRef.current)) : locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.other')
188
179
  }
189
180
  }));
190
-
191
181
  dispatch(updateComponent('FailCustom'));
192
182
  return;
193
183
  }
@@ -260,7 +250,8 @@ export var useValidate = function useValidate(check, num, onChange) {
260
250
  netRef = _useStoreRef2.netRef,
261
251
  payRef = _useStoreRef2.payRef,
262
252
  numRef = _useStoreRef2.numRef,
263
- modeRef = _useStoreRef2.modeRef;
253
+ modeRef = _useStoreRef2.modeRef,
254
+ clientRef = _useStoreRef2.clientRef;
264
255
  var stepRef = useRef(custom === null || custom === void 0 ? void 0 : custom.step);
265
256
  var listRef = useRef(custom === null || custom === void 0 ? void 0 : custom.list);
266
257
  useEffect(function () {
@@ -50,7 +50,8 @@ export default (function (_ref) {
50
50
  netRef = _useStoreRef.netRef,
51
51
  symbolRef = _useStoreRef.symbolRef,
52
52
  amountRef = _useStoreRef.amountRef,
53
- eftposRef = _useStoreRef.eftposRef;
53
+ eftposRef = _useStoreRef.eftposRef,
54
+ clientRef = _useStoreRef.clientRef;
54
55
  var dispatch = useDispatch();
55
56
  var fail = useFail();
56
57
  var failRef = useRef(fail);
@@ -83,7 +83,7 @@ var isBooking4Shop = (shopId, renderType) => {
83
83
  if (renderType === "eventBooking") {
84
84
  return false;
85
85
  }
86
- const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726];
86
+ const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320, 7362, 6497, 6087, 6303, 6726, 8191];
87
87
  return booking4Shops.includes(shopId);
88
88
  };
89
89
  // Annotate the CommonJS export names for ESM import in node:
@@ -7,14 +7,15 @@ import { PosProps } from './const';
7
7
  * @Author: hongbing.wang
8
8
  * @Date: 2024-08-12 11:35
9
9
  */
10
- declare const _default: ({ className, onChange, onClose, formatAmount, isIpad, net, }: {
10
+ declare const _default: ({ className, onChange, onClose, formatAmount, isMobile, net, client }: {
11
11
  className?: string | undefined;
12
12
  onChange?: ((status: "page" | "success" | "fail", params?: string | {
13
13
  [keys: string]: unknown;
14
- } | undefined) => void) | undefined;
14
+ } | undefined, other?: any) => void) | undefined;
15
15
  onClose: () => void;
16
16
  formatAmount(amount: number | string, precision: number, symbol: string): string;
17
- isIpad: boolean;
17
+ isMobile: boolean;
18
18
  net: boolean;
19
+ client: string;
19
20
  }) => React.JSX.Element;
20
21
  export default _default;
@@ -46,8 +46,9 @@ var amount_default = ({
46
46
  onChange,
47
47
  onClose,
48
48
  formatAmount = (number, precision, symbol) => `${symbol}${number}`,
49
- isIpad,
50
- net
49
+ isMobile,
50
+ net,
51
+ client
51
52
  }) => {
52
53
  const dispatch = (0, import_store.useDispatch)();
53
54
  const [status, setStatus] = (0, import_react.useState)(true);
@@ -131,7 +132,7 @@ var amount_default = ({
131
132
  setTempSurRate(curSurRate);
132
133
  setTempSurMoney(curSurMoney);
133
134
  };
134
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-amount ${className}` }, isIpad ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, status ? name : import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.title")), status ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-body" }, /* @__PURE__ */ import_react.default.createElement(
135
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-amount ${className}` }, isMobile ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, status ? name : import_utils.locales.getText("page.eftpos-pay.text.surcharge.edit.title")), status ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-amount-body" }, /* @__PURE__ */ import_react.default.createElement(
135
136
  "div",
136
137
  {
137
138
  className: "pisell-lowcode__eft-pay-cash",
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ActionProps } from '../../const';
3
- declare const _default: ({ className, isIpad, onChange }: ActionProps) => React.JSX.Element;
3
+ declare const _default: ({ className, isMobile, onChange }: ActionProps) => React.JSX.Element;
4
4
  export default _default;
@@ -41,7 +41,7 @@ var import_manufacturer = require("../../manufacturer");
41
41
  var import_XClose = __toESM(require("@pisell/icon/es/XClose"));
42
42
  var import_store = require("../../store");
43
43
  var import_header = __toESM(require("../header"));
44
- var failCustom_default = ({ className = "", isIpad, onChange }) => {
44
+ var failCustom_default = ({ className = "", isMobile, onChange }) => {
45
45
  const {
46
46
  eftpos,
47
47
  custom,
@@ -51,7 +51,8 @@ var failCustom_default = ({ className = "", isIpad, onChange }) => {
51
51
  amount,
52
52
  order_id,
53
53
  number,
54
- device
54
+ device,
55
+ client
55
56
  } = (0, import_store.useContextData)();
56
57
  const failCustom = custom == null ? void 0 : custom.failCustom;
57
58
  const dispatch = (0, import_store.useDispatch)();
@@ -96,6 +97,9 @@ var failCustom_default = ({ className = "", isIpad, onChange }) => {
96
97
  );
97
98
  dispatch((0, import_store.updateComponent)("Manual"));
98
99
  };
100
+ const onNotin = () => {
101
+ onChange("print", [], "print_on_timeout");
102
+ };
99
103
  const onClose = () => {
100
104
  onChange("fail", { number, device, order_id });
101
105
  };
@@ -104,14 +108,14 @@ var failCustom_default = ({ className = "", isIpad, onChange }) => {
104
108
  onChange("page", "fail");
105
109
  }
106
110
  });
107
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: failCustom.status }, (failCustom == null ? void 0 : failCustom.status) === "fail" && !isIpad ? /* @__PURE__ */ import_react.default.createElement(
111
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: failCustom.status }, (failCustom == null ? void 0 : failCustom.status) === "fail" && !isMobile ? /* @__PURE__ */ import_react.default.createElement(
108
112
  import_XClose.default,
109
113
  {
110
114
  size: 20,
111
115
  style: { fontSize: "24px", position: "absolute", top: 0, right: 0 },
112
116
  onClick: onClose
113
117
  }
114
- ) : null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, failCustom.title || import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)), (failCustom == null ? void 0 : failCustom.status) === "fail" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body" }, failCustom == null ? void 0 : failCustom.fail) : (failCustom == null ? void 0 : failCustom.status) === "warn" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, failCustom == null ? void 0 : failCustom.warn) : null, (failCustom == null ? void 0 : failCustom.isPosNetworkError) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
118
+ ) : null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, failCustom.title || import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)), (failCustom == null ? void 0 : failCustom.status) === "fail" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body" }, failCustom == null ? void 0 : failCustom.fail) : (failCustom == null ? void 0 : failCustom.status) === "warn" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, failCustom == null ? void 0 : failCustom.warn) : null, (failCustom == null ? void 0 : failCustom.isPosNetworkError) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement(
115
119
  import_antd.Button,
116
120
  {
117
121
  block: true,
@@ -119,6 +123,14 @@ var failCustom_default = ({ className = "", isIpad, onChange }) => {
119
123
  onClick: onManually
120
124
  },
121
125
  import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
126
+ ) : /* @__PURE__ */ import_react.default.createElement(
127
+ import_antd.Button,
128
+ {
129
+ block: true,
130
+ className: "pisell-lowcode__eft-pay-step-item-btn",
131
+ onClick: onNotin
132
+ },
133
+ import_utils.locales.getText("page.eftpos-pay.text.manual.print_receipt")
122
134
  )) : /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
123
135
  import_antd.Button,
124
136
  {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ActionProps } from '../../const';
3
- declare const _default: ({ onChange, className, isIpad }: ActionProps) => React.JSX.Element;
3
+ declare const _default: ({ onChange, className, isMobile }: ActionProps) => React.JSX.Element;
4
4
  export default _default;
@@ -37,10 +37,11 @@ var import_antd = require("antd");
37
37
  var import_ahooks = require("ahooks");
38
38
  var import_react = __toESM(require("react"));
39
39
  var import_XClose = __toESM(require("@pisell/icon/es/XClose"));
40
+ var import_const = require("../../const");
40
41
  var import_manufacturer = require("../../manufacturer");
41
42
  var import_store = require("../../store");
42
43
  var import_header = __toESM(require("../header"));
43
- var fail_default = ({ onChange, className = "", isIpad }) => {
44
+ var fail_default = ({ onChange, className = "", isMobile }) => {
44
45
  var _a, _b;
45
46
  const {
46
47
  eftpos,
@@ -52,7 +53,8 @@ var fail_default = ({ onChange, className = "", isIpad }) => {
52
53
  amount,
53
54
  order_id,
54
55
  number,
55
- device
56
+ device,
57
+ client
56
58
  } = (0, import_store.useContextData)();
57
59
  const isPosNetworkError = ((_b = (_a = steps[step]) == null ? void 0 : _a.custom) == null ? void 0 : _b.isPosNetworkError) || false;
58
60
  const dispatch = (0, import_store.useDispatch)();
@@ -101,6 +103,9 @@ var fail_default = ({ onChange, className = "", isIpad }) => {
101
103
  );
102
104
  dispatch((0, import_store.updateComponent)("Manual"));
103
105
  };
106
+ const onNotin = () => {
107
+ onChange("print", [], "print_on_timeout");
108
+ };
104
109
  const onClose = () => {
105
110
  onChange("fail", { number, device, order_id });
106
111
  };
@@ -109,14 +114,14 @@ var fail_default = ({ onChange, className = "", isIpad }) => {
109
114
  onChange("page", "fail");
110
115
  }
111
116
  });
112
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: steps[step].status }, steps[step].status === "fail" && !isIpad ? /* @__PURE__ */ import_react.default.createElement(
117
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: steps[step].status }, steps[step].status === "fail" && !isMobile ? /* @__PURE__ */ import_react.default.createElement(
113
118
  import_XClose.default,
114
119
  {
115
120
  size: 20,
116
121
  style: { fontSize: "24px", position: "absolute", top: 0, right: 0 },
117
122
  onClick: onClose
118
123
  }
119
- ) : null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, steps[step].title || import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)), steps[step].status === "fail" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body" }, steps[step].fail) : steps[step].status === "warn" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, steps[step].warn) : null, isPosNetworkError ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
124
+ ) : null), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, steps[step].title || import_utils.locales.getText("page.eftpos-pay.text.failed")(mode)), steps[step].status === "fail" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body" }, steps[step].fail) : steps[step].status === "warn" ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, steps[step].warn) : null, isPosNetworkError ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement(
120
125
  import_antd.Button,
121
126
  {
122
127
  block: true,
@@ -124,6 +129,14 @@ var fail_default = ({ onChange, className = "", isIpad }) => {
124
129
  onClick: onManually
125
130
  },
126
131
  import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
132
+ ) : /* @__PURE__ */ import_react.default.createElement(
133
+ import_antd.Button,
134
+ {
135
+ block: true,
136
+ className: "pisell-lowcode__eft-pay-step-item-btn",
137
+ onClick: onNotin
138
+ },
139
+ import_utils.locales.getText("page.eftpos-pay.text.manual.print_receipt")
127
140
  )) : /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
128
141
  import_antd.Button,
129
142
  {
@@ -6,5 +6,5 @@ import { ActionProps } from '../../const';
6
6
  * @Author: hongbing.wang
7
7
  * @Date: 2024-08-20 11:42
8
8
  */
9
- declare const _default: ({ className }: ActionProps) => React.JSX.Element;
9
+ declare const _default: ({ onChange, className }: ActionProps) => React.JSX.Element;
10
10
  export default _default;
@@ -35,10 +35,11 @@ module.exports = __toCommonJS(unknow_exports);
35
35
  var import_utils = require("@pisell/utils");
36
36
  var import_antd = require("antd");
37
37
  var import_react = __toESM(require("react"));
38
+ var import_const = require("../../const");
38
39
  var import_store = require("../../store");
39
40
  var import_header = __toESM(require("../header"));
40
- var unknow_default = ({ className = "" }) => {
41
- const { form, mode } = (0, import_store.useContextData)();
41
+ var unknow_default = ({ onChange, className = "" }) => {
42
+ const { form, mode, client } = (0, import_store.useContextData)();
42
43
  const dispatch = (0, import_store.useDispatch)();
43
44
  const onManually = () => {
44
45
  dispatch(
@@ -55,12 +56,15 @@ var unknow_default = ({ className = "" }) => {
55
56
  );
56
57
  dispatch((0, import_store.updateComponent)("Manual"));
57
58
  };
59
+ const onNotin = () => {
60
+ onChange("print", [], "print_on_timeout");
61
+ };
58
62
  (0, import_react.useEffect)(() => {
59
63
  if (form === "Network" || form === "restore") {
60
64
  dispatch((0, import_store.updateComponent)(""));
61
65
  }
62
66
  }, [form]);
63
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: "warn" }), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, import_utils.locales.getText("page.eftpos-pay.text.unknown.title")(mode)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, import_utils.locales.getText("page.eftpos-pay.text.unknown.text")(mode)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, /* @__PURE__ */ import_react.default.createElement(
67
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-box ${className}` }, /* @__PURE__ */ import_react.default.createElement(import_header.default, { status: "warn" }), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-fail-title" }, import_utils.locales.getText("page.eftpos-pay.text.unknown.title")(mode)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body" }, client === import_const.ClientEnum.Merchant ? import_utils.locales.getText("page.eftpos-pay.text.unknown.text")(mode) : import_utils.locales.getText("page.eftpos-pay.text.transaction.eftpos.fail.other")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-step-item-btns" }, client === import_const.ClientEnum.Merchant ? /* @__PURE__ */ import_react.default.createElement(
64
68
  import_antd.Button,
65
69
  {
66
70
  block: true,
@@ -68,5 +72,13 @@ var unknow_default = ({ className = "" }) => {
68
72
  onClick: onManually
69
73
  },
70
74
  import_utils.locales.getText("page.eftpos-pay.text.manual.marking")
75
+ ) : /* @__PURE__ */ import_react.default.createElement(
76
+ import_antd.Button,
77
+ {
78
+ block: true,
79
+ className: "pisell-lowcode__eft-pay-step-item-btn",
80
+ onClick: onNotin
81
+ },
82
+ import_utils.locales.getText("page.eftpos-pay.text.manual.print_receipt")
71
83
  )));
72
84
  };
@@ -27,6 +27,12 @@ export declare enum ModeEnum {
27
27
  /** 查询 */
28
28
  Query = "query"
29
29
  }
30
+ export declare enum ClientEnum {
31
+ /** 用户端 */
32
+ User = "user",
33
+ /** 商家端 */
34
+ Merchant = "merchant"
35
+ }
30
36
  export declare enum RouteEnum {
31
37
  /** 改价页 */
32
38
  Amount = "amount",
@@ -56,7 +62,7 @@ export interface PosProps {
56
62
  /** 回调 */
57
63
  onChangeStatus: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}` | 'page', params?: {
58
64
  [keys: string]: unknown;
59
- } | string) => void;
65
+ } | string, other?: any) => void;
60
66
  onChangeParams(...agrn: unknown[]): void;
61
67
  terminal: {
62
68
  network: boolean;
@@ -144,6 +150,6 @@ export interface ActionProps {
144
150
  [key: string]: (...agrn: unknown[]) => Promise<unknown>;
145
151
  };
146
152
  className?: string;
147
- isIpad?: boolean;
153
+ isMobile?: boolean;
148
154
  formatAmount: (amount: number | string, precision: number, symbol: string) => string;
149
155
  }
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/components/eftposPay/const.ts
20
20
  var const_exports = {};
21
21
  __export(const_exports, {
22
+ ClientEnum: () => ClientEnum,
22
23
  EftposEnum: () => EftposEnum,
23
24
  ModeEnum: () => ModeEnum,
24
25
  PayRouteEnum: () => PayRouteEnum,
@@ -52,6 +53,11 @@ var ModeEnum = /* @__PURE__ */ ((ModeEnum2) => {
52
53
  ModeEnum2["Query"] = "query";
53
54
  return ModeEnum2;
54
55
  })(ModeEnum || {});
56
+ var ClientEnum = /* @__PURE__ */ ((ClientEnum2) => {
57
+ ClientEnum2["User"] = "user";
58
+ ClientEnum2["Merchant"] = "merchant";
59
+ return ClientEnum2;
60
+ })(ClientEnum || {});
55
61
  var RouteEnum = /* @__PURE__ */ ((RouteEnum2) => {
56
62
  RouteEnum2["Amount"] = "amount";
57
63
  RouteEnum2["DeviceList"] = "deviceList";
@@ -80,6 +86,7 @@ var PayStatus = /* @__PURE__ */ ((PayStatus2) => {
80
86
  })(PayStatus || {});
81
87
  // Annotate the CommonJS export names for ESM import in node:
82
88
  0 && (module.exports = {
89
+ ClientEnum,
83
90
  EftposEnum,
84
91
  ModeEnum,
85
92
  PayRouteEnum,
@@ -8,16 +8,17 @@ import './device.less';
8
8
  * @Author: hongbing.wang
9
9
  * @Date: 2024-08-12 11:40
10
10
  */
11
- declare const _default: ({ api, onChange, onClose, className, device_number, isIpad, net, formatAmount, }: {
11
+ declare const _default: ({ api, onChange, onClose, className, device_number, isMobile, net, client, formatAmount, }: {
12
12
  api: PayProps['api'];
13
13
  className?: string | undefined;
14
14
  onChange?: ((status: "page" | "success" | "fail", params?: string | {
15
15
  [keys: string]: unknown;
16
- } | undefined) => void) | undefined;
16
+ } | undefined, other?: any) => void) | undefined;
17
17
  onClose: () => void;
18
18
  device_number?: string | number | undefined;
19
- isIpad: boolean;
19
+ isMobile: boolean;
20
20
  net: boolean;
21
+ client: string;
21
22
  formatAmount(amount: number | string, precision: number, symbol: string): string;
22
23
  }) => React.JSX.Element;
23
24
  export default _default;
@@ -49,8 +49,9 @@ var device_default = ({
49
49
  onClose,
50
50
  className = "",
51
51
  device_number,
52
- isIpad,
52
+ isMobile,
53
53
  net,
54
+ client,
54
55
  formatAmount = (number, precision, symbol) => `${symbol}${number}`
55
56
  }) => {
56
57
  const store = (0, import_store.useContextData)();
@@ -145,11 +146,11 @@ var device_default = ({
145
146
  return { ...item, pay };
146
147
  });
147
148
  };
148
- return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-device-box ${className}` }, isIpad ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, dataStaus ? import_utils.locales.getText("page.eftpos-pay.text.device") : ""), dataStaus ? /* @__PURE__ */ import_react.default.createElement(
149
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: `pisell-lowcode__eft-pay-device-box ${className}` }, isMobile ? null : /* @__PURE__ */ import_react.default.createElement(import_titlebar.default, { type: "left-title-close", onClose }, dataStaus ? import_utils.locales.getText("page.eftpos-pay.text.device") : ""), dataStaus ? /* @__PURE__ */ import_react.default.createElement(
149
150
  "div",
150
151
  {
151
152
  className: "pisell-lowcode__eft-pay-device-list",
152
- style: isIpad ? { marginTop: "20px" } : {}
153
+ style: isMobile ? { marginTop: "20px" } : {}
153
154
  },
154
155
  /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { spinning: loading, style: { flex: 1, overflow: "auto" } }, /* @__PURE__ */ import_react.default.createElement(
155
156
  "div",
@@ -183,7 +184,7 @@ var device_default = ({
183
184
  "div",
184
185
  {
185
186
  className: "pisell-lowcode__eft-pay-device-error",
186
- style: isIpad ? { marginTop: "20px" } : {}
187
+ style: isMobile ? { marginTop: "20px" } : {}
187
188
  },
188
189
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-error-tit" }, import_utils.locales.getText("page.eftpos-pay.text.device.no.title")),
189
190
  /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__eft-pay-device-error-txt" }, import_utils.locales.getText("page.eftpos-pay.text.device.no.add")),
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PayStatus } from './const';
3
- import { ModeEnum } from './const';
3
+ import { ModeEnum, ClientEnum } from './const';
4
4
  export declare const useStoreRef: <T extends {
5
5
  [key: string]: unknown;
6
6
  } = {
@@ -20,6 +20,7 @@ export declare const useStoreRef: <T extends {
20
20
  readonly symbolRef: React.MutableRefObject<string>;
21
21
  readonly amountRef: React.MutableRefObject<string | number>;
22
22
  readonly eftposRef: React.MutableRefObject<"tyro" | "windcave" | "payo" | "stripe">;
23
+ readonly clientRef: React.MutableRefObject<ClientEnum>;
23
24
  };
24
25
  /**
25
26
  * @title: 通用失败处理
@@ -28,6 +29,6 @@ export declare const useStoreRef: <T extends {
28
29
  * @Author: hongbing.wang
29
30
  * @Date: 2024-08-12 11:54
30
31
  */
31
- export declare const useFail: (index: number, isMark?: boolean) => (res: {
32
+ export declare const useFail: (index: number) => (res: {
32
33
  code?: "200" | "4004" | "701000" | "701001" | "701003" | "701004" | "701005" | "701006" | "701007" | "701008" | "701009" | "701010" | undefined;
33
- }) => void;
34
+ }, isMark?: boolean) => void;
@@ -27,6 +27,7 @@ var import_utils = require("@pisell/utils");
27
27
  var import_react = require("react");
28
28
  var import_const = require("./const");
29
29
  var import_store = require("./store");
30
+ var import_const2 = require("./const");
30
31
  var Max4004 = 1;
31
32
  var useStoreRef = () => {
32
33
  const {
@@ -39,7 +40,8 @@ var useStoreRef = () => {
39
40
  status,
40
41
  symbol,
41
42
  amount,
42
- eftpos
43
+ eftpos,
44
+ client
43
45
  } = (0, import_store.useContextData)();
44
46
  const deviceRef = (0, import_react.useRef)(device);
45
47
  const payRef = (0, import_react.useRef)(pay);
@@ -51,6 +53,7 @@ var useStoreRef = () => {
51
53
  const symbolRef = (0, import_react.useRef)(symbol);
52
54
  const amountRef = (0, import_react.useRef)(amount);
53
55
  const eftposRef = (0, import_react.useRef)(eftpos);
56
+ const clientRef = (0, import_react.useRef)(client);
54
57
  (0, import_react.useEffect)(() => {
55
58
  deviceRef.current = device;
56
59
  }, [device]);
@@ -81,6 +84,9 @@ var useStoreRef = () => {
81
84
  (0, import_react.useEffect)(() => {
82
85
  eftposRef.current = eftpos;
83
86
  }, [eftpos]);
87
+ (0, import_react.useEffect)(() => {
88
+ clientRef.current = client;
89
+ }, [client]);
84
90
  return {
85
91
  deviceRef,
86
92
  payRef,
@@ -91,19 +97,20 @@ var useStoreRef = () => {
91
97
  netRef,
92
98
  symbolRef,
93
99
  amountRef,
94
- eftposRef
100
+ eftposRef,
101
+ clientRef
95
102
  };
96
103
  };
97
- var useFail = (index, isMark = false) => {
104
+ var useFail = (index) => {
98
105
  const { steps, custom } = (0, import_store.useContextData)();
99
- const { modeRef } = useStoreRef();
106
+ const { modeRef, clientRef } = useStoreRef();
100
107
  const dispatch = (0, import_store.useDispatch)();
101
108
  const ref = (0, import_react.useRef)((custom == null ? void 0 : custom.retry) || 0);
102
109
  (0, import_react.useEffect)(() => {
103
110
  ref.current = (custom == null ? void 0 : custom.retry) || 0;
104
111
  }, [custom == null ? void 0 : custom.retry]);
105
112
  return (0, import_react.useCallback)(
106
- (res) => {
113
+ (res, isMark = false) => {
107
114
  if (!res || !res.code) {
108
115
  dispatch(
109
116
  (0, import_store.updateCustom)({
@@ -153,6 +160,21 @@ var useFail = (index, isMark = false) => {
153
160
  }
154
161
  if (code === import_const.PayStatus.Timeout) {
155
162
  if (isMark) {
163
+ if (clientRef.current === import_const2.ClientEnum.User) {
164
+ steps[index].status = "fail";
165
+ steps[index].title = import_utils.locales.getText("page.eftpos-pay.text.timedout.title");
166
+ steps[index].fail = import_utils.locales.getText("page.eftpos-pay.text.transaction.eftpos.fail.other");
167
+ steps[index].custom = steps[index].custom ? { ...steps[index].custom, isPosNetworkError: true } : { isPosNetworkError: true };
168
+ dispatch((0, import_store.updateSteps)(steps));
169
+ dispatch((0, import_store.updateComponent)("Fail"));
170
+ dispatch(
171
+ (0, import_store.updateCustom)({
172
+ errorStatus: "know"
173
+ // unknow know
174
+ })
175
+ );
176
+ return;
177
+ }
156
178
  steps[index].status = "fail";
157
179
  dispatch((0, import_store.updateSteps)(steps));
158
180
  dispatch(
@@ -268,7 +290,7 @@ var useFail = (index, isMark = false) => {
268
290
  steps[index].title = import_utils.locales.getText(
269
291
  "page.eftpos-pay.text.interrupted"
270
292
  );
271
- steps[index].warn = `${import_utils.locales.getText(
293
+ steps[index].warn = clientRef.current === import_const2.ClientEnum.Merchant ? `${import_utils.locales.getText(
272
294
  "page.eftpos-pay.text.transaction.eftpos.fail.title"
273
295
  )}
274
296
  ${import_utils.locales.getText(
@@ -282,7 +304,7 @@ ${import_utils.locales.getText(
282
304
  )}
283
305
  ${import_utils.locales.getText(
284
306
  "page.eftpos-pay.text.transaction.eftpos.fail.if"
285
- )(modeRef.current)}`;
307
+ )(modeRef.current)}` : import_utils.locales.getText("page.eftpos-pay.text.transaction.eftpos.fail.other");
286
308
  steps[index].status = "warn";
287
309
  steps[index].custom = steps[index].custom ? { ...steps[index].custom, isPosNetworkError: true } : { isPosNetworkError: true };
288
310
  dispatch((0, import_store.updateSteps)(steps));
@@ -365,7 +387,7 @@ ${import_utils.locales.getText(
365
387
  );
366
388
  dispatch((0, import_store.updateComponent)("UnknowFail"));
367
389
  },
368
- [dispatch, index, steps, isMark]
390
+ [dispatch, index, steps]
369
391
  );
370
392
  };
371
393
  // Annotate the CommonJS export names for ESM import in node: