@pisell/private-materials 3.0.187 → 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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +3 -3
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/components/eftposPay/amount.d.ts +4 -3
- package/es/components/eftposPay/amount.js +5 -4
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -1
- package/es/components/eftposPay/component/fail/failCustom.js +14 -6
- package/es/components/eftposPay/component/fail/index.d.ts +1 -1
- package/es/components/eftposPay/component/fail/index.js +14 -5
- package/es/components/eftposPay/component/fail/unknow.d.ts +1 -1
- package/es/components/eftposPay/component/fail/unknow.js +17 -7
- package/es/components/eftposPay/const.d.ts +8 -2
- package/es/components/eftposPay/const.js +5 -0
- package/es/components/eftposPay/device.d.ts +4 -3
- package/es/components/eftposPay/device.js +5 -4
- package/es/components/eftposPay/hooks.d.ts +4 -3
- package/es/components/eftposPay/hooks.js +31 -6
- package/es/components/eftposPay/index.js +57 -23
- package/es/components/eftposPay/index.less +1 -0
- package/es/components/eftposPay/locales.d.ts +6 -0
- package/es/components/eftposPay/locales.js +6 -0
- package/es/components/eftposPay/pay.d.ts +3 -2
- package/es/components/eftposPay/pay.js +8 -7
- package/es/components/eftposPay/payo/config.d.ts +3 -1
- package/es/components/eftposPay/payo/config.js +11 -9
- package/es/components/eftposPay/payo/const.js +4 -2
- package/es/components/eftposPay/payo/index.js +3 -1
- package/es/components/eftposPay/store/index.d.ts +17 -2
- package/es/components/eftposPay/store/index.js +20 -0
- package/es/components/eftposPay/tyro/const.js +4 -2
- package/es/components/eftposPay/tyro/index.js +70 -20
- package/es/components/eftposPay/windcave/const.js +4 -2
- package/es/components/eftposPay/windcave/helper.js +19 -28
- package/es/components/eftposPay/windcave/windcave.js +2 -1
- package/lib/components/eftposPay/amount.d.ts +4 -3
- package/lib/components/eftposPay/amount.js +4 -3
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -1
- package/lib/components/eftposPay/component/fail/failCustom.js +16 -4
- package/lib/components/eftposPay/component/fail/index.d.ts +1 -1
- package/lib/components/eftposPay/component/fail/index.js +17 -4
- package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -1
- package/lib/components/eftposPay/component/fail/unknow.js +15 -3
- package/lib/components/eftposPay/const.d.ts +8 -2
- package/lib/components/eftposPay/const.js +7 -0
- package/lib/components/eftposPay/device.d.ts +4 -3
- package/lib/components/eftposPay/device.js +5 -4
- package/lib/components/eftposPay/hooks.d.ts +4 -3
- package/lib/components/eftposPay/hooks.js +30 -8
- package/lib/components/eftposPay/index.js +46 -18
- package/lib/components/eftposPay/index.less +1 -0
- package/lib/components/eftposPay/locales.d.ts +6 -0
- package/lib/components/eftposPay/locales.js +6 -0
- package/lib/components/eftposPay/pay.d.ts +3 -2
- package/lib/components/eftposPay/pay.js +7 -6
- package/lib/components/eftposPay/payo/config.d.ts +3 -1
- package/lib/components/eftposPay/payo/config.js +8 -8
- package/lib/components/eftposPay/payo/const.js +2 -0
- package/lib/components/eftposPay/payo/index.js +1 -1
- package/lib/components/eftposPay/store/index.d.ts +17 -2
- package/lib/components/eftposPay/store/index.js +14 -0
- package/lib/components/eftposPay/tyro/const.js +2 -0
- package/lib/components/eftposPay/tyro/index.js +63 -6
- package/lib/components/eftposPay/windcave/const.js +2 -0
- package/lib/components/eftposPay/windcave/helper.js +23 -28
- package/lib/components/eftposPay/windcave/windcave.js +2 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
183
|
+
* isMobile 确认关闭按钮 出现在哪里
|
|
183
184
|
*/
|
|
184
185
|
return /*#__PURE__*/React.createElement("div", {
|
|
185
186
|
className: "pisell-lowcode__eft-pay-amount ".concat(className)
|
|
186
|
-
},
|
|
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,
|
|
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
|
-
|
|
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' && !
|
|
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'))
|
|
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,
|
|
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
|
-
|
|
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' && !
|
|
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'))
|
|
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
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
332
|
+
}, [dispatch, index, steps]);
|
|
308
333
|
};
|
|
@@ -19,12 +19,12 @@ import React, { useEffect, useState, useMemo, useRef, useCallback } from 'react'
|
|
|
19
19
|
import { useNetwork } from 'ahooks';
|
|
20
20
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
21
21
|
import Amount from "./amount";
|
|
22
|
-
import { RouteEnum, ModeEnum } from "./const";
|
|
22
|
+
import { RouteEnum, ModeEnum, ClientEnum } from "./const";
|
|
23
23
|
import Device from "./device";
|
|
24
24
|
import localeTexts from "./locales";
|
|
25
25
|
import { getInitState } from "./manufacturer";
|
|
26
26
|
import Pay from "./pay";
|
|
27
|
-
import { Provider, useContextData, useDispatch, updateState } from "./store";
|
|
27
|
+
import { Provider, useContextData, useDispatch, updateState, updateClient } from "./store";
|
|
28
28
|
import "./index.less";
|
|
29
29
|
locales.init(localeTexts, localStorage.getItem('umi_locale') || 'en');
|
|
30
30
|
var App = function App(_ref) {
|
|
@@ -50,12 +50,16 @@ var App = function App(_ref) {
|
|
|
50
50
|
formatAmount: function formatAmount(number, precision, symbol) {
|
|
51
51
|
return "".concat(symbol).concat(number);
|
|
52
52
|
},
|
|
53
|
-
|
|
54
|
-
return
|
|
53
|
+
storage: function storage() {
|
|
54
|
+
return {
|
|
55
|
+
get: function get() {
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
};
|
|
55
59
|
}
|
|
56
60
|
},
|
|
57
61
|
formatAmount = _ref2.formatAmount,
|
|
58
|
-
|
|
62
|
+
storage = _ref2.storage;
|
|
59
63
|
|
|
60
64
|
// 外部网络数据
|
|
61
65
|
var network = useMemo(function () {
|
|
@@ -86,9 +90,36 @@ var App = function App(_ref) {
|
|
|
86
90
|
useEffect(function () {
|
|
87
91
|
statusRef.current = data.status;
|
|
88
92
|
}, [data.status]);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* terminal : terminal 内嵌
|
|
96
|
+
* android_kiosk : kiosk 内嵌
|
|
97
|
+
*/
|
|
98
|
+
var channel = useMemo(function () {
|
|
99
|
+
var _storage$get;
|
|
100
|
+
var channel = (storage === null || storage === void 0 ? void 0 : (_storage$get = storage.get) === null || _storage$get === void 0 ? void 0 : _storage$get.call(storage, 'channel')) || '';
|
|
101
|
+
if (channel === 'terminal') {
|
|
102
|
+
return 'terminal';
|
|
103
|
+
}
|
|
104
|
+
if (channel === 'android_kiosk') {
|
|
105
|
+
return 'kiosk';
|
|
106
|
+
}
|
|
107
|
+
return '';
|
|
108
|
+
}, []);
|
|
109
|
+
var client = useMemo(function () {
|
|
110
|
+
if (channel === 'kiosk') {
|
|
111
|
+
return ClientEnum.User;
|
|
112
|
+
}
|
|
113
|
+
return ClientEnum.Merchant;
|
|
114
|
+
}, [channel]);
|
|
115
|
+
useEffect(function () {
|
|
116
|
+
dispatch(updateClient(client));
|
|
117
|
+
}, [client]);
|
|
118
|
+
|
|
119
|
+
// 内嵌在 terminal 或者 kiosk 的移动端 做特定移动端(大屏)适配
|
|
120
|
+
var isMobile = useMemo(function () {
|
|
121
|
+
return Boolean(channel);
|
|
122
|
+
}, [channel]);
|
|
92
123
|
|
|
93
124
|
/**
|
|
94
125
|
* @title: api 接口 数据
|
|
@@ -123,7 +154,7 @@ var App = function App(_ref) {
|
|
|
123
154
|
* @Author: hongbing.wang
|
|
124
155
|
* @Date: 2024-08-20 13:10
|
|
125
156
|
*/
|
|
126
|
-
var onChange = useCallback(function (status, params) {
|
|
157
|
+
var onChange = useCallback(function (status, params, other) {
|
|
127
158
|
if (status === 'page' && typeof params === 'string') {
|
|
128
159
|
if (['amount', 'deviceList', 'pay'].includes(params)) {
|
|
129
160
|
setCurrent(params);
|
|
@@ -132,8 +163,8 @@ var App = function App(_ref) {
|
|
|
132
163
|
}));
|
|
133
164
|
}
|
|
134
165
|
}
|
|
135
|
-
console.log('状态切换 = ', status, params);
|
|
136
|
-
props.onChangeStatus(status, params);
|
|
166
|
+
console.log('状态切换 = ', status, params, other);
|
|
167
|
+
props.onChangeStatus(status, params, other);
|
|
137
168
|
}, []);
|
|
138
169
|
|
|
139
170
|
/**
|
|
@@ -153,11 +184,12 @@ var App = function App(_ref) {
|
|
|
153
184
|
api: api,
|
|
154
185
|
onChange: onChange,
|
|
155
186
|
onClose: onClose,
|
|
156
|
-
|
|
157
|
-
className:
|
|
187
|
+
isMobile: isMobile,
|
|
188
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
158
189
|
net: net,
|
|
159
190
|
device_number: device_number,
|
|
160
|
-
formatAmount: formatAmount
|
|
191
|
+
formatAmount: formatAmount,
|
|
192
|
+
client: client
|
|
161
193
|
});
|
|
162
194
|
}
|
|
163
195
|
if (current === RouteEnum.Amount) {
|
|
@@ -165,9 +197,10 @@ var App = function App(_ref) {
|
|
|
165
197
|
onChange: onChange,
|
|
166
198
|
onClose: onClose,
|
|
167
199
|
formatAmount: formatAmount,
|
|
168
|
-
|
|
169
|
-
className:
|
|
170
|
-
net: net
|
|
200
|
+
isMobile: isMobile,
|
|
201
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
202
|
+
net: net,
|
|
203
|
+
client: client
|
|
171
204
|
});
|
|
172
205
|
}
|
|
173
206
|
return /*#__PURE__*/React.createElement(Pay, {
|
|
@@ -175,11 +208,12 @@ var App = function App(_ref) {
|
|
|
175
208
|
tyroUrl: tyroUrl,
|
|
176
209
|
tyroVersion: tyroVersion,
|
|
177
210
|
onChange: onChange,
|
|
178
|
-
className:
|
|
211
|
+
className: isMobile ? 'pisell-lowcode__eft-pay-terminal' : '',
|
|
179
212
|
terminal: terminal,
|
|
180
|
-
|
|
213
|
+
isMobile: isMobile,
|
|
181
214
|
net: net,
|
|
182
|
-
formatAmount: formatAmount
|
|
215
|
+
formatAmount: formatAmount,
|
|
216
|
+
client: client
|
|
183
217
|
});
|
|
184
218
|
};
|
|
185
219
|
export default (function (props) {
|
|
@@ -226,8 +260,8 @@ export default (function (props) {
|
|
|
226
260
|
symbol: current
|
|
227
261
|
});
|
|
228
262
|
}, [mode, props.params, props.type, symbol]);
|
|
229
|
-
var onChangeStatus = useCallback(function (status, params) {
|
|
230
|
-
props.onChangeStatus(status, params);
|
|
263
|
+
var onChangeStatus = useCallback(function (status, params, other) {
|
|
264
|
+
props.onChangeStatus(status, params, other);
|
|
231
265
|
}, []);
|
|
232
266
|
var action = useMemo(function () {
|
|
233
267
|
var act = function () {
|
|
@@ -262,7 +296,7 @@ export default (function (props) {
|
|
|
262
296
|
}, [mode, state]);
|
|
263
297
|
useEffect(function () {
|
|
264
298
|
// document.body.id = 'body';
|
|
265
|
-
console.log('初始化 ........');
|
|
299
|
+
console.log('初始化 ........11221801');
|
|
266
300
|
}, []);
|
|
267
301
|
|
|
268
302
|
// console.log('action = ', action);
|
|
@@ -256,6 +256,7 @@
|
|
|
256
256
|
.pisell-lowcode__eft-pay-terminal {
|
|
257
257
|
width: var(--pisel-lc-pos-terminal-width, 100%) !important;
|
|
258
258
|
height: var(--pisel-lc-pos-terminal-height, 100%) !important;
|
|
259
|
+
max-height: var(--pisel-lc-pos-terminal-max-height, unset) !important;
|
|
259
260
|
display: flex;
|
|
260
261
|
flex-direction: column;
|
|
261
262
|
}
|