@pisell/private-materials 3.0.186 → 3.0.188

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 (101) 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/addons/model.d.ts +1 -2
  12. package/es/components/booking/forms/model.d.ts +1 -2
  13. package/es/components/booking/notes/index.d.ts +1 -1
  14. package/es/components/booking/notes/model.d.ts +1 -2
  15. package/es/components/booking/payments/model.d.ts +1 -2
  16. package/es/components/eftposPay/amount.d.ts +4 -3
  17. package/es/components/eftposPay/amount.js +5 -4
  18. package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  19. package/es/components/eftposPay/component/fail/failCustom.js +14 -6
  20. package/es/components/eftposPay/component/fail/index.d.ts +1 -1
  21. package/es/components/eftposPay/component/fail/index.js +14 -5
  22. package/es/components/eftposPay/component/fail/unknow.d.ts +1 -1
  23. package/es/components/eftposPay/component/fail/unknow.js +17 -7
  24. package/es/components/eftposPay/const.d.ts +8 -2
  25. package/es/components/eftposPay/const.js +5 -0
  26. package/es/components/eftposPay/device.d.ts +4 -3
  27. package/es/components/eftposPay/device.js +5 -4
  28. package/es/components/eftposPay/hooks.d.ts +4 -3
  29. package/es/components/eftposPay/hooks.js +31 -6
  30. package/es/components/eftposPay/index.js +57 -23
  31. package/es/components/eftposPay/index.less +1 -0
  32. package/es/components/eftposPay/locales.d.ts +6 -0
  33. package/es/components/eftposPay/locales.js +6 -0
  34. package/es/components/eftposPay/pay.d.ts +3 -2
  35. package/es/components/eftposPay/pay.js +8 -7
  36. package/es/components/eftposPay/payo/config.d.ts +3 -1
  37. package/es/components/eftposPay/payo/config.js +11 -9
  38. package/es/components/eftposPay/payo/const.js +4 -2
  39. package/es/components/eftposPay/payo/index.js +3 -1
  40. package/es/components/eftposPay/store/index.d.ts +17 -2
  41. package/es/components/eftposPay/store/index.js +20 -0
  42. package/es/components/eftposPay/tyro/const.js +4 -2
  43. package/es/components/eftposPay/tyro/index.js +70 -20
  44. package/es/components/eftposPay/windcave/const.js +4 -2
  45. package/es/components/eftposPay/windcave/helper.js +19 -28
  46. package/es/components/eftposPay/windcave/windcave.js +2 -1
  47. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +10 -4
  48. package/es/components/pisellSelectCustomerModal/RightPanel/index.js +5 -3
  49. package/es/components/pisellSelectCustomerModal/RightPanel/index.less +7 -0
  50. package/es/components/pisellSelectCustomerModal/index.js +7 -1
  51. package/es/components/pisellSelectCustomerModal/index.less +6 -0
  52. package/es/components/pisellSelectCustomerModal/locales.d.ts +6 -0
  53. package/es/components/pisellSelectCustomerModal/locales.js +9 -3
  54. package/es/components/schedules/index.d.ts +1 -1
  55. package/es/components/schedules/model.d.ts +1 -2
  56. package/lib/components/booking/addons/model.d.ts +1 -2
  57. package/lib/components/booking/forms/model.d.ts +1 -2
  58. package/lib/components/booking/notes/index.d.ts +1 -1
  59. package/lib/components/booking/notes/model.d.ts +1 -2
  60. package/lib/components/booking/payments/model.d.ts +1 -2
  61. package/lib/components/eftposPay/amount.d.ts +4 -3
  62. package/lib/components/eftposPay/amount.js +4 -3
  63. package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -1
  64. package/lib/components/eftposPay/component/fail/failCustom.js +16 -4
  65. package/lib/components/eftposPay/component/fail/index.d.ts +1 -1
  66. package/lib/components/eftposPay/component/fail/index.js +17 -4
  67. package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -1
  68. package/lib/components/eftposPay/component/fail/unknow.js +15 -3
  69. package/lib/components/eftposPay/const.d.ts +8 -2
  70. package/lib/components/eftposPay/const.js +7 -0
  71. package/lib/components/eftposPay/device.d.ts +4 -3
  72. package/lib/components/eftposPay/device.js +5 -4
  73. package/lib/components/eftposPay/hooks.d.ts +4 -3
  74. package/lib/components/eftposPay/hooks.js +30 -8
  75. package/lib/components/eftposPay/index.js +46 -18
  76. package/lib/components/eftposPay/index.less +1 -0
  77. package/lib/components/eftposPay/locales.d.ts +6 -0
  78. package/lib/components/eftposPay/locales.js +6 -0
  79. package/lib/components/eftposPay/pay.d.ts +3 -2
  80. package/lib/components/eftposPay/pay.js +7 -6
  81. package/lib/components/eftposPay/payo/config.d.ts +3 -1
  82. package/lib/components/eftposPay/payo/config.js +8 -8
  83. package/lib/components/eftposPay/payo/const.js +2 -0
  84. package/lib/components/eftposPay/payo/index.js +1 -1
  85. package/lib/components/eftposPay/store/index.d.ts +17 -2
  86. package/lib/components/eftposPay/store/index.js +14 -0
  87. package/lib/components/eftposPay/tyro/const.js +2 -0
  88. package/lib/components/eftposPay/tyro/index.js +63 -6
  89. package/lib/components/eftposPay/windcave/const.js +2 -0
  90. package/lib/components/eftposPay/windcave/helper.js +23 -28
  91. package/lib/components/eftposPay/windcave/windcave.js +2 -1
  92. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +3 -0
  93. package/lib/components/pisellSelectCustomerModal/RightPanel/index.js +5 -3
  94. package/lib/components/pisellSelectCustomerModal/RightPanel/index.less +7 -0
  95. package/lib/components/pisellSelectCustomerModal/index.js +7 -0
  96. package/lib/components/pisellSelectCustomerModal/index.less +6 -0
  97. package/lib/components/pisellSelectCustomerModal/locales.d.ts +6 -0
  98. package/lib/components/pisellSelectCustomerModal/locales.js +9 -3
  99. package/lib/components/schedules/index.d.ts +1 -1
  100. package/lib/components/schedules/model.d.ts +1 -2
  101. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: any;
8
8
  export default Notes;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -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;
@@ -34,8 +34,9 @@ export default (function (_ref) {
34
34
  formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
35
35
  return "".concat(symbol).concat(number);
36
36
  } : _ref$formatAmount,
37
- isIpad = _ref.isIpad,
38
- net = _ref.net;
37
+ isMobile = _ref.isMobile,
38
+ net = _ref.net,
39
+ client = _ref.client;
39
40
  var dispatch = useDispatch();
40
41
  var _useState = useState(true),
41
42
  _useState2 = _slicedToArray(_useState, 2),
@@ -179,11 +180,11 @@ export default (function (_ref) {
179
180
  /**
180
181
  * 1. 金额编辑页 status :true
181
182
  * 2. 手续费编辑页 status :false
182
- * isIpad 确认关闭按钮 出现在哪里
183
+ * isMobile 确认关闭按钮 出现在哪里
183
184
  */
184
185
  return /*#__PURE__*/React.createElement("div", {
185
186
  className: "pisell-lowcode__eft-pay-amount ".concat(className)
186
- }, isIpad ? null : /*#__PURE__*/React.createElement(Titlebar, {
187
+ }, isMobile ? null : /*#__PURE__*/React.createElement(Titlebar, {
187
188
  type: 'left-title-close',
188
189
  onClose: onClose
189
190
  }, status ? name : locales.getText('page.eftpos-pay.text.surcharge.edit.title')), status ? /*#__PURE__*/React.createElement("div", {
@@ -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;
@@ -3,7 +3,7 @@ import { locales } from '@pisell/utils';
3
3
  import { useMount } from 'ahooks';
4
4
  import { Button } from 'antd';
5
5
  import React from 'react';
6
- import { ModeEnum } from "../../const";
6
+ import { ModeEnum, ClientEnum } from "../../const";
7
7
  import { getInitState } from "../../manufacturer";
8
8
  import XClose from '@pisell/icon/es/XClose';
9
9
  import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
@@ -11,7 +11,7 @@ import Header from "../header";
11
11
  export default (function (_ref) {
12
12
  var _ref$className = _ref.className,
13
13
  className = _ref$className === void 0 ? '' : _ref$className,
14
- isIpad = _ref.isIpad,
14
+ isMobile = _ref.isMobile,
15
15
  onChange = _ref.onChange;
16
16
  var _useContextData = useContextData(),
17
17
  eftpos = _useContextData.eftpos,
@@ -22,7 +22,8 @@ export default (function (_ref) {
22
22
  amount = _useContextData.amount,
23
23
  order_id = _useContextData.order_id,
24
24
  number = _useContextData.number,
25
- device = _useContextData.device;
25
+ device = _useContextData.device,
26
+ client = _useContextData.client;
26
27
  var failCustom = custom === null || custom === void 0 ? void 0 : custom.failCustom;
27
28
  var dispatch = useDispatch();
28
29
 
@@ -82,6 +83,9 @@ export default (function (_ref) {
82
83
  }));
83
84
  dispatch(updateComponent('Manual'));
84
85
  };
86
+ var onNotin = function onNotin() {
87
+ onChange('print', [], 'print_on_timeout');
88
+ };
85
89
 
86
90
  /**
87
91
  * @title: 关闭支付页面
@@ -107,7 +111,7 @@ export default (function (_ref) {
107
111
  className: "pisell-lowcode__eft-pay-box ".concat(className)
108
112
  }, /*#__PURE__*/React.createElement(Header, {
109
113
  status: failCustom.status
110
- }, (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' && !isIpad ? /*#__PURE__*/React.createElement(XClose, {
114
+ }, (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' && !isMobile ? /*#__PURE__*/React.createElement(XClose, {
111
115
  size: 20,
112
116
  style: {
113
117
  fontSize: '24px',
@@ -124,11 +128,15 @@ export default (function (_ref) {
124
128
  className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
125
129
  }, failCustom === null || failCustom === void 0 ? void 0 : failCustom.warn) : null, failCustom !== null && failCustom !== void 0 && failCustom.isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
126
130
  className: "pisell-lowcode__eft-pay-step-item-btns"
127
- }, /*#__PURE__*/React.createElement(Button, {
131
+ }, client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement(Button, {
128
132
  block: true,
129
133
  className: "pisell-lowcode__eft-pay-step-item-btn",
130
134
  onClick: onManually
131
- }, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
135
+ }, locales.getText('page.eftpos-pay.text.manual.marking')) : /*#__PURE__*/React.createElement(Button, {
136
+ block: true,
137
+ className: "pisell-lowcode__eft-pay-step-item-btn",
138
+ onClick: onNotin
139
+ }, locales.getText('page.eftpos-pay.text.manual.print_receipt'))) : /*#__PURE__*/React.createElement("div", {
132
140
  className: "pisell-lowcode__eft-pay-step-item-btns"
133
141
  }, /*#__PURE__*/React.createElement(Button, {
134
142
  block: true,
@@ -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;
@@ -4,6 +4,7 @@ import { Button } from 'antd';
4
4
  import { useMount } from 'ahooks';
5
5
  import React from 'react';
6
6
  import XClose from '@pisell/icon/es/XClose';
7
+ import { ClientEnum } from "../../const";
7
8
  import { getInitState } from "../../manufacturer";
8
9
  import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
9
10
  import Header from "../header";
@@ -12,7 +13,7 @@ export default (function (_ref) {
12
13
  var onChange = _ref.onChange,
13
14
  _ref$className = _ref.className,
14
15
  className = _ref$className === void 0 ? '' : _ref$className,
15
- isIpad = _ref.isIpad;
16
+ isMobile = _ref.isMobile;
16
17
  var _useContextData = useContextData(),
17
18
  eftpos = _useContextData.eftpos,
18
19
  step = _useContextData.step,
@@ -23,7 +24,8 @@ export default (function (_ref) {
23
24
  amount = _useContextData.amount,
24
25
  order_id = _useContextData.order_id,
25
26
  number = _useContextData.number,
26
- device = _useContextData.device;
27
+ device = _useContextData.device,
28
+ client = _useContextData.client;
27
29
  var isPosNetworkError = ((_steps$step = steps[step]) === null || _steps$step === void 0 ? void 0 : (_steps$step$custom = _steps$step.custom) === null || _steps$step$custom === void 0 ? void 0 : _steps$step$custom.isPosNetworkError) || false;
28
30
  var dispatch = useDispatch();
29
31
 
@@ -77,6 +79,9 @@ export default (function (_ref) {
77
79
  }));
78
80
  dispatch(updateComponent('Manual'));
79
81
  };
82
+ var onNotin = function onNotin() {
83
+ onChange('print', [], 'print_on_timeout');
84
+ };
80
85
 
81
86
  /**
82
87
  * @title: 关闭支付页面
@@ -103,7 +108,7 @@ export default (function (_ref) {
103
108
  className: "pisell-lowcode__eft-pay-box ".concat(className)
104
109
  }, /*#__PURE__*/React.createElement(Header, {
105
110
  status: steps[step].status
106
- }, steps[step].status === 'fail' && !isIpad ? /*#__PURE__*/React.createElement(XClose, {
111
+ }, steps[step].status === 'fail' && !isMobile ? /*#__PURE__*/React.createElement(XClose, {
107
112
  size: 20,
108
113
  style: {
109
114
  fontSize: '24px',
@@ -120,11 +125,15 @@ export default (function (_ref) {
120
125
  className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
121
126
  }, steps[step].warn) : null, isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
122
127
  className: "pisell-lowcode__eft-pay-step-item-btns"
123
- }, /*#__PURE__*/React.createElement(Button, {
128
+ }, client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement(Button, {
124
129
  block: true,
125
130
  className: "pisell-lowcode__eft-pay-step-item-btn",
126
131
  onClick: onManually
127
- }, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
132
+ }, locales.getText('page.eftpos-pay.text.manual.marking')) : /*#__PURE__*/React.createElement(Button, {
133
+ block: true,
134
+ className: "pisell-lowcode__eft-pay-step-item-btn",
135
+ onClick: onNotin
136
+ }, locales.getText('page.eftpos-pay.text.manual.print_receipt'))) : /*#__PURE__*/React.createElement("div", {
128
137
  className: "pisell-lowcode__eft-pay-step-item-btns"
129
138
  }, /*#__PURE__*/React.createElement(Button, {
130
139
  block: true,
@@ -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;
@@ -2,21 +2,24 @@
2
2
  import { locales } from '@pisell/utils';
3
3
  import { Button } from 'antd';
4
4
  import React, { useEffect } from 'react';
5
+ import { ClientEnum } from "../../const";
5
6
  import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
6
7
  import Header from "../header";
7
8
 
8
9
  /**
9
10
  * @title: 支付状态未知页面
10
- * @description:
11
+ * @description:
11
12
  * @Author: hongbing.wang
12
13
  * @Date: 2024-08-20 11:42
13
14
  */
14
15
  export default (function (_ref) {
15
- var _ref$className = _ref.className,
16
+ var onChange = _ref.onChange,
17
+ _ref$className = _ref.className,
16
18
  className = _ref$className === void 0 ? '' : _ref$className;
17
19
  var _useContextData = useContextData(),
18
20
  form = _useContextData.form,
19
- mode = _useContextData.mode;
21
+ mode = _useContextData.mode,
22
+ client = _useContextData.client;
20
23
  var dispatch = useDispatch();
21
24
 
22
25
  /**
@@ -34,8 +37,11 @@ export default (function (_ref) {
34
37
  }));
35
38
  dispatch(updateComponent('Manual'));
36
39
  };
40
+ var onNotin = function onNotin() {
41
+ onChange('print', [], 'print_on_timeout');
42
+ };
37
43
  useEffect(function () {
38
- // 如果 网络终端 恢复至此页面 则需要 回归 步骤流程
44
+ // 如果 网络终端 恢复至此页面 则需要 回归 步骤流程
39
45
  if (form === 'Network' || form === 'restore') {
40
46
  dispatch(updateComponent(''));
41
47
  }
@@ -48,11 +54,15 @@ export default (function (_ref) {
48
54
  className: "pisell-lowcode__eft-pay-fail-title"
49
55
  }, locales.getText('page.eftpos-pay.text.unknown.title')(mode)), /*#__PURE__*/React.createElement("div", {
50
56
  className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
51
- }, locales.getText('page.eftpos-pay.text.unknown.text')(mode)), /*#__PURE__*/React.createElement("div", {
57
+ }, 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", {
52
58
  className: "pisell-lowcode__eft-pay-step-item-btns"
53
- }, /*#__PURE__*/React.createElement(Button, {
59
+ }, client === ClientEnum.Merchant ? /*#__PURE__*/React.createElement(Button, {
54
60
  block: true,
55
61
  className: "pisell-lowcode__eft-pay-step-item-btn",
56
62
  onClick: onManually
57
- }, locales.getText('page.eftpos-pay.text.manual.marking'))));
63
+ }, locales.getText('page.eftpos-pay.text.manual.marking')) : /*#__PURE__*/React.createElement(Button, {
64
+ block: true,
65
+ className: "pisell-lowcode__eft-pay-step-item-btn",
66
+ onClick: onNotin
67
+ }, locales.getText('page.eftpos-pay.text.manual.print_receipt'))));
58
68
  });
@@ -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
  }
@@ -23,6 +23,11 @@ export var ModeEnum;
23
23
  ModeEnum["Refund"] = "refund";
24
24
  ModeEnum["Query"] = "query";
25
25
  })(ModeEnum || (ModeEnum = {}));
26
+ export var ClientEnum;
27
+ (function (ClientEnum) {
28
+ ClientEnum["User"] = "user";
29
+ ClientEnum["Merchant"] = "merchant";
30
+ })(ClientEnum || (ClientEnum = {}));
26
31
  export var RouteEnum;
27
32
  (function (RouteEnum) {
28
33
  RouteEnum["Amount"] = "amount";
@@ -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;
@@ -36,8 +36,9 @@ export default (function (_ref) {
36
36
  _ref$className = _ref.className,
37
37
  className = _ref$className === void 0 ? '' : _ref$className,
38
38
  device_number = _ref.device_number,
39
- isIpad = _ref.isIpad,
39
+ isMobile = _ref.isMobile,
40
40
  net = _ref.net,
41
+ client = _ref.client,
41
42
  _ref$formatAmount = _ref.formatAmount,
42
43
  formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
43
44
  return "".concat(symbol).concat(number);
@@ -167,12 +168,12 @@ export default (function (_ref) {
167
168
  };
168
169
  return /*#__PURE__*/React.createElement("div", {
169
170
  className: "pisell-lowcode__eft-pay-device-box ".concat(className)
170
- }, isIpad ? null : /*#__PURE__*/React.createElement(Titlebar, {
171
+ }, isMobile ? null : /*#__PURE__*/React.createElement(Titlebar, {
171
172
  type: "left-title-close",
172
173
  onClose: onClose
173
174
  }, dataStaus ? locales.getText('page.eftpos-pay.text.device') : ''), dataStaus ? /*#__PURE__*/React.createElement("div", {
174
175
  className: "pisell-lowcode__eft-pay-device-list",
175
- style: isIpad ? {
176
+ style: isMobile ? {
176
177
  marginTop: '20px'
177
178
  } : {}
178
179
  }, /*#__PURE__*/React.createElement(Spin, {
@@ -218,7 +219,7 @@ export default (function (_ref) {
218
219
  })));
219
220
  })))) : /*#__PURE__*/React.createElement("div", {
220
221
  className: "pisell-lowcode__eft-pay-device-error",
221
- style: isIpad ? {
222
+ style: isMobile ? {
222
223
  marginTop: '20px'
223
224
  } : {}
224
225
  }, /*#__PURE__*/React.createElement("div", {
@@ -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;
@@ -8,6 +8,7 @@ import { locales } from '@pisell/utils';
8
8
  import { useCallback, useEffect, useRef } from 'react';
9
9
  import { PayStatus } from "./const";
10
10
  import { useContextData, useDispatch, updateComponent, updateSteps, updateState, updateCustom, updateKey } from "./store";
11
+ import { ClientEnum } from "./const";
11
12
  var Max4004 = 1;
12
13
 
13
14
  // 穿越 react deep
@@ -22,7 +23,8 @@ export var useStoreRef = function useStoreRef() {
22
23
  status = _useContextData.status,
23
24
  symbol = _useContextData.symbol,
24
25
  amount = _useContextData.amount,
25
- eftpos = _useContextData.eftpos;
26
+ eftpos = _useContextData.eftpos,
27
+ client = _useContextData.client;
26
28
  // 设备信息
27
29
  var deviceRef = useRef(device);
28
30
 
@@ -52,6 +54,7 @@ export var useStoreRef = function useStoreRef() {
52
54
 
53
55
  // 设备类型
54
56
  var eftposRef = useRef(eftpos);
57
+ var clientRef = useRef(client);
55
58
  useEffect(function () {
56
59
  deviceRef.current = device;
57
60
  }, [device]);
@@ -82,6 +85,9 @@ export var useStoreRef = function useStoreRef() {
82
85
  useEffect(function () {
83
86
  eftposRef.current = eftpos;
84
87
  }, [eftpos]);
88
+ useEffect(function () {
89
+ clientRef.current = client;
90
+ }, [client]);
85
91
  return {
86
92
  deviceRef: deviceRef,
87
93
  payRef: payRef,
@@ -92,7 +98,8 @@ export var useStoreRef = function useStoreRef() {
92
98
  netRef: netRef,
93
99
  symbolRef: symbolRef,
94
100
  amountRef: amountRef,
95
- eftposRef: eftposRef
101
+ eftposRef: eftposRef,
102
+ clientRef: clientRef
96
103
  };
97
104
  };
98
105
 
@@ -104,18 +111,19 @@ export var useStoreRef = function useStoreRef() {
104
111
  * @Date: 2024-08-12 11:54
105
112
  */
106
113
  export var useFail = function useFail(index) {
107
- var isMark = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
108
114
  var _useContextData2 = useContextData(),
109
115
  steps = _useContextData2.steps,
110
116
  custom = _useContextData2.custom;
111
117
  var _useStoreRef = useStoreRef(),
112
- modeRef = _useStoreRef.modeRef;
118
+ modeRef = _useStoreRef.modeRef,
119
+ clientRef = _useStoreRef.clientRef;
113
120
  var dispatch = useDispatch();
114
121
  var ref = useRef((custom === null || custom === void 0 ? void 0 : custom.retry) || 0);
115
122
  useEffect(function () {
116
123
  ref.current = (custom === null || custom === void 0 ? void 0 : custom.retry) || 0;
117
124
  }, [custom === null || custom === void 0 ? void 0 : custom.retry]);
118
125
  return useCallback(function (res) {
126
+ var isMark = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
119
127
  if (!res || !res.code) {
120
128
  // 去往未知处理页面
121
129
  dispatch(updateCustom({
@@ -154,6 +162,23 @@ export var useFail = function useFail(index) {
154
162
  }
155
163
  if (code === PayStatus.Timeout) {
156
164
  if (isMark) {
165
+ if (clientRef.current === ClientEnum.User) {
166
+ steps[index].status = 'fail';
167
+ steps[index].title = locales.getText('page.eftpos-pay.text.timedout.title');
168
+ steps[index].fail = locales.getText('page.eftpos-pay.text.transaction.eftpos.fail.other');
169
+ steps[index].custom = steps[index].custom ? _objectSpread(_objectSpread({}, steps[index].custom), {}, {
170
+ isPosNetworkError: true
171
+ }) : {
172
+ isPosNetworkError: true
173
+ };
174
+ dispatch(updateSteps(steps));
175
+ dispatch(updateComponent('Fail'));
176
+ dispatch(updateCustom({
177
+ errorStatus: 'know' // unknow know
178
+ }));
179
+
180
+ return;
181
+ }
157
182
  // 超时 前往标记页
158
183
  steps[index].status = 'fail';
159
184
  dispatch(updateSteps(steps));
@@ -239,7 +264,7 @@ export var useFail = function useFail(index) {
239
264
  if (code === PayStatus.NoNetWork || code === PayStatus.SocketError) {
240
265
  // 前往错误页 可标记状态
241
266
  steps[index].title = locales.getText('page.eftpos-pay.text.interrupted');
242
- steps[index].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));
267
+ steps[index].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');
243
268
  steps[index].status = 'warn';
244
269
  steps[index].custom = steps[index].custom ? _objectSpread(_objectSpread({}, steps[index].custom), {}, {
245
270
  isPosNetworkError: true
@@ -304,5 +329,5 @@ export var useFail = function useFail(index) {
304
329
  }));
305
330
 
306
331
  dispatch(updateComponent('UnknowFail'));
307
- }, [dispatch, index, steps, isMark]);
332
+ }, [dispatch, index, steps]);
308
333
  };