@pisell/private-materials 3.0.136 → 3.0.137
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 +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/eftpos/const.d.ts +26 -0
- package/es/components/eftpos/const.js +40 -8
- package/es/components/eftpos/device.d.ts +3 -2
- package/es/components/eftpos/device.js +6 -5
- package/es/components/eftpos/form/index.d.ts +5 -0
- package/es/components/eftpos/form/index.js +8 -0
- package/es/components/eftpos/hooks.d.ts +34 -0
- package/es/components/{eftposPay/windcave/hook.js → eftpos/hooks.js} +96 -122
- package/es/components/eftpos/icon/apiKey.d.ts +5 -0
- package/es/components/eftpos/icon/apiKey.js +17 -0
- package/es/components/eftpos/icon/device.d.ts +5 -0
- package/es/components/eftpos/icon/device.js +19 -0
- package/es/components/eftpos/index.d.ts +10 -0
- package/es/components/eftpos/index.js +329 -46
- package/es/components/eftpos/index.less +38 -1
- package/es/components/eftpos/locales.d.ts +12 -0
- package/es/components/eftpos/locales.js +15 -3
- package/es/components/eftpos/log.d.ts +8 -0
- package/es/components/eftpos/log.js +85 -0
- package/es/components/eftpos/pos.d.ts +1 -1
- package/es/components/eftpos/pos.js +8 -5
- package/es/components/eftpos/surcharge/index.d.ts +25 -2
- package/es/components/eftpos/surcharge/index.js +100 -16
- package/es/components/eftpos/table.d.ts +4 -0
- package/es/components/eftpos/table.js +102 -10
- package/es/components/eftposPay/amount.d.ts +7 -1
- package/es/components/eftposPay/amount.js +65 -38
- package/es/components/eftposPay/component/fail/failCustom.js +65 -20
- package/es/components/eftposPay/component/fail/index.js +60 -30
- package/es/components/eftposPay/component/fail/network.d.ts +5 -0
- package/es/components/eftposPay/component/fail/network.js +13 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +6 -0
- package/es/components/eftposPay/component/fail/unknow.js +18 -3
- package/es/components/eftposPay/component/header/index.d.ts +2 -1
- package/es/components/eftposPay/component/header/index.js +4 -1
- package/es/components/eftposPay/component/header/index.less +1 -10
- package/es/components/eftposPay/component/manual/index.d.ts +6 -1
- package/es/components/eftposPay/component/manual/index.js +174 -23
- package/es/components/eftposPay/component/manual/index.less +42 -14
- package/es/components/eftposPay/component/signature/index.d.ts +5 -0
- package/es/components/eftposPay/component/signature/index.js +20 -2
- package/es/components/eftposPay/component/step/index.d.ts +7 -7
- package/es/components/eftposPay/component/step/step.d.ts +4 -4
- package/es/components/eftposPay/const.d.ts +19 -4
- package/es/components/eftposPay/const.js +4 -2
- package/es/components/eftposPay/device.d.ts +7 -0
- package/es/components/eftposPay/device.js +22 -0
- package/es/components/eftposPay/helper.d.ts +54 -0
- package/es/components/eftposPay/helper.js +93 -1
- package/es/components/eftposPay/hooks.d.ts +30 -1
- package/es/components/eftposPay/hooks.js +181 -26
- package/es/components/eftposPay/index.d.ts +2 -4
- package/es/components/eftposPay/index.js +119 -31
- package/es/components/eftposPay/index.less +27 -19
- package/es/components/eftposPay/locales.d.ts +45 -0
- package/es/components/eftposPay/locales.js +348 -3
- package/es/components/eftposPay/manufacturer.d.ts +2 -2
- package/es/components/eftposPay/manufacturer.js +9 -10
- package/es/components/eftposPay/pay.d.ts +10 -1
- package/es/components/eftposPay/pay.js +112 -34
- package/es/components/eftposPay/payo/config.js +137 -270
- package/es/components/eftposPay/payo/const.d.ts +22 -2
- package/es/components/eftposPay/payo/const.js +83 -33
- package/es/components/eftposPay/payo/hooks.d.ts +5 -0
- package/es/components/eftposPay/payo/hooks.js +19 -2
- package/es/components/eftposPay/store/index.d.ts +154 -53
- package/es/components/eftposPay/store/index.js +112 -60
- package/es/components/eftposPay/tyro/const.d.ts +17 -0
- package/es/components/eftposPay/{eftpos → tyro}/const.js +71 -90
- package/es/components/eftposPay/tyro/hooks.d.ts +14 -0
- package/es/components/eftposPay/tyro/hooks.js +40 -0
- package/es/components/eftposPay/tyro/index.d.ts +9 -0
- package/es/components/eftposPay/tyro/index.js +575 -0
- package/es/components/eftposPay/windcave/const.d.ts +24 -9
- package/es/components/eftposPay/windcave/const.js +90 -81
- package/es/components/eftposPay/windcave/helper.d.ts +16 -2
- package/es/components/eftposPay/windcave/helper.js +175 -42
- package/es/components/eftposPay/windcave/receiptAction.d.ts +12 -0
- package/es/components/eftposPay/windcave/receiptAction.js +91 -43
- package/es/components/eftposPay/windcave/timer.d.ts +13 -1
- package/es/components/eftposPay/windcave/timer.js +18 -1
- package/es/components/eftposPay/windcave/windcave.d.ts +2 -1
- package/es/components/eftposPay/windcave/windcave.js +155 -139
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/es/utils/load.d.ts +11 -0
- package/es/utils/load.js +85 -0
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/eftpos/const.d.ts +26 -0
- package/lib/components/eftpos/const.js +13 -1
- package/lib/components/eftpos/device.d.ts +3 -2
- package/lib/components/eftpos/device.js +2 -2
- package/lib/components/eftpos/form/index.d.ts +5 -0
- package/lib/components/eftpos/hooks.d.ts +34 -0
- package/lib/components/eftpos/hooks.js +106 -0
- package/lib/components/eftpos/icon/apiKey.d.ts +5 -0
- package/lib/components/eftpos/icon/apiKey.js +57 -0
- package/lib/components/eftpos/icon/device.d.ts +5 -0
- package/lib/components/eftpos/icon/device.js +57 -0
- package/lib/components/eftpos/index.d.ts +10 -0
- package/lib/components/eftpos/index.js +262 -97
- package/lib/components/eftpos/index.less +38 -1
- package/lib/components/eftpos/locales.d.ts +12 -0
- package/lib/components/eftpos/locales.js +15 -3
- package/lib/components/eftpos/log.d.ts +8 -0
- package/lib/components/eftpos/log.js +87 -0
- package/lib/components/eftpos/pos.d.ts +1 -1
- package/lib/components/eftpos/pos.js +5 -4
- package/lib/components/eftpos/surcharge/index.d.ts +25 -2
- package/lib/components/eftpos/surcharge/index.js +36 -6
- package/lib/components/eftpos/table.d.ts +4 -0
- package/lib/components/eftpos/table.js +40 -8
- package/lib/components/eftposPay/amount.d.ts +7 -1
- package/lib/components/eftposPay/amount.js +10 -33
- package/lib/components/eftposPay/component/fail/failCustom.js +27 -6
- package/lib/components/eftposPay/component/fail/index.js +39 -18
- package/lib/components/eftposPay/component/fail/network.d.ts +5 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +6 -0
- package/lib/components/eftposPay/component/fail/unknow.js +3 -3
- package/lib/components/eftposPay/component/header/index.d.ts +2 -1
- package/lib/components/eftposPay/component/header/index.js +2 -1
- package/lib/components/eftposPay/component/header/index.less +1 -10
- package/lib/components/eftposPay/component/manual/index.d.ts +6 -1
- package/lib/components/eftposPay/component/manual/index.js +122 -31
- package/lib/components/eftposPay/component/manual/index.less +42 -14
- package/lib/components/eftposPay/component/signature/index.d.ts +5 -0
- package/lib/components/eftposPay/component/signature/index.js +2 -2
- package/lib/components/eftposPay/component/step/index.d.ts +7 -7
- package/lib/components/eftposPay/component/step/step.d.ts +4 -4
- package/lib/components/eftposPay/const.d.ts +19 -4
- package/lib/components/eftposPay/const.js +3 -1
- package/lib/components/eftposPay/device.d.ts +7 -0
- package/lib/components/eftposPay/helper.d.ts +54 -0
- package/lib/components/eftposPay/helper.js +64 -0
- package/lib/components/eftposPay/hooks.d.ts +30 -1
- package/lib/components/eftposPay/hooks.js +182 -44
- package/lib/components/eftposPay/index.d.ts +2 -4
- package/lib/components/eftposPay/index.js +74 -27
- package/lib/components/eftposPay/index.less +27 -19
- package/lib/components/eftposPay/locales.d.ts +45 -0
- package/lib/components/eftposPay/locales.js +352 -3
- package/lib/components/eftposPay/manufacturer.d.ts +2 -2
- package/lib/components/eftposPay/manufacturer.js +13 -13
- package/lib/components/eftposPay/pay.d.ts +10 -1
- package/lib/components/eftposPay/pay.js +86 -25
- package/lib/components/eftposPay/payo/config.js +121 -268
- package/lib/components/eftposPay/payo/const.d.ts +22 -2
- package/lib/components/eftposPay/payo/const.js +55 -36
- package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
- package/lib/components/eftposPay/payo/hooks.js +1 -1
- package/lib/components/eftposPay/store/index.d.ts +154 -53
- package/lib/components/eftposPay/store/index.js +7 -66
- package/lib/components/eftposPay/tyro/const.d.ts +17 -0
- package/lib/components/eftposPay/tyro/const.js +114 -0
- package/lib/components/eftposPay/tyro/hooks.d.ts +14 -0
- package/lib/components/eftposPay/{eftpos/index.js → tyro/hooks.js} +31 -36
- package/lib/components/eftposPay/tyro/index.d.ts +9 -0
- package/lib/components/eftposPay/tyro/index.js +558 -0
- package/lib/components/eftposPay/windcave/const.d.ts +24 -9
- package/lib/components/eftposPay/windcave/const.js +53 -104
- package/lib/components/eftposPay/windcave/helper.d.ts +16 -2
- package/lib/components/eftposPay/windcave/helper.js +163 -48
- package/lib/components/eftposPay/windcave/receiptAction.d.ts +12 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +15 -47
- package/lib/components/eftposPay/windcave/timer.d.ts +13 -1
- package/lib/components/eftposPay/windcave/timer.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.d.ts +2 -1
- package/lib/components/eftposPay/windcave/windcave.js +130 -130
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/lib/utils/load.d.ts +11 -0
- package/lib/utils/load.js +100 -0
- package/lowcode/eftpos/meta.ts +202 -160
- package/lowcode/eftpos-pay/meta.ts +45 -12
- package/package.json +4 -4
- package/es/components/eftposPay/eftpos/config.d.ts +0 -11
- package/es/components/eftposPay/eftpos/config.js +0 -178
- package/es/components/eftposPay/eftpos/const.d.ts +0 -10
- package/es/components/eftposPay/eftpos/index.d.ts +0 -7
- package/es/components/eftposPay/eftpos/index.js +0 -35
- package/es/components/eftposPay/windcave/action.d.ts +0 -8
- package/es/components/eftposPay/windcave/action.js +0 -104
- package/es/components/eftposPay/windcave/hook.d.ts +0 -14
- package/es/components/eftposPay/windcave/index.d.ts +0 -8
- package/es/components/eftposPay/windcave/index.js +0 -49
- package/es/components/eftposPay/windcave/pos.d.ts +0 -8
- package/es/components/eftposPay/windcave/pos.js +0 -180
- package/es/components/eftposPay/windcave/pwd.d.ts +0 -8
- package/es/components/eftposPay/windcave/pwd.js +0 -124
- package/es/components/eftposPay/windcave/receipet.d.ts +0 -6
- package/es/components/eftposPay/windcave/receipet.js +0 -67
- package/es/components/eftposPay/windcave/wait.d.ts +0 -12
- package/es/components/eftposPay/windcave/wait.js +0 -139
- package/lib/components/eftposPay/eftpos/config.d.ts +0 -11
- package/lib/components/eftposPay/eftpos/config.js +0 -199
- package/lib/components/eftposPay/eftpos/const.d.ts +0 -10
- package/lib/components/eftposPay/eftpos/const.js +0 -165
- package/lib/components/eftposPay/eftpos/index.d.ts +0 -7
- package/lib/components/eftposPay/windcave/action.d.ts +0 -8
- package/lib/components/eftposPay/windcave/action.js +0 -143
- package/lib/components/eftposPay/windcave/hook.d.ts +0 -14
- package/lib/components/eftposPay/windcave/hook.js +0 -139
- package/lib/components/eftposPay/windcave/index.d.ts +0 -8
- package/lib/components/eftposPay/windcave/index.js +0 -78
- package/lib/components/eftposPay/windcave/pos.d.ts +0 -8
- package/lib/components/eftposPay/windcave/pos.js +0 -197
- package/lib/components/eftposPay/windcave/pwd.d.ts +0 -8
- package/lib/components/eftposPay/windcave/pwd.js +0 -143
- package/lib/components/eftposPay/windcave/receipet.d.ts +0 -6
- package/lib/components/eftposPay/windcave/receipet.js +0 -93
- package/lib/components/eftposPay/windcave/wait.d.ts +0 -12
- package/lib/components/eftposPay/windcave/wait.js +0 -163
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
var _excluded = ["key"],
|
|
2
|
-
_excluded2 = ["key"],
|
|
3
|
-
_excluded3 = ["key"],
|
|
4
|
-
_excluded4 = ["key"],
|
|
5
|
-
_excluded5 = ["key"],
|
|
6
|
-
_excluded6 = ["key"],
|
|
7
|
-
_excluded7 = ["key"];
|
|
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
|
-
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
|
-
/* eslint-disable no-unused-vars */
|
|
11
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
12
|
-
import { locales } from '@pisell/utils';
|
|
13
|
-
import { Button } from 'antd';
|
|
14
|
-
import React, { useEffect } from 'react';
|
|
15
|
-
import Step from "../component/step";
|
|
16
|
-
import { useContextData, useDispatch, updateNextStep, updateStatus, updateComponent, updateSteps, updateWarn, updateStep, updateState } from "../store";
|
|
17
|
-
export var POS = function POS() {
|
|
18
|
-
var dispatch = useDispatch();
|
|
19
|
-
var _useContextData = useContextData(),
|
|
20
|
-
steps = _useContextData.steps;
|
|
21
|
-
var _steps$ = steps[0],
|
|
22
|
-
key = _steps$.key,
|
|
23
|
-
props = _objectWithoutProperties(_steps$, _excluded);
|
|
24
|
-
useEffect(function () {
|
|
25
|
-
setTimeout(function () {
|
|
26
|
-
dispatch(updateStep({
|
|
27
|
-
step: 1
|
|
28
|
-
}));
|
|
29
|
-
}, 2000);
|
|
30
|
-
}, []);
|
|
31
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
32
|
-
};
|
|
33
|
-
export var Surcharge = function Surcharge() {
|
|
34
|
-
var dispatch = useDispatch();
|
|
35
|
-
var _useContextData2 = useContextData(),
|
|
36
|
-
steps = _useContextData2.steps;
|
|
37
|
-
var _steps$2 = steps[1],
|
|
38
|
-
key = _steps$2.key,
|
|
39
|
-
props = _objectWithoutProperties(_steps$2, _excluded2);
|
|
40
|
-
useEffect(function () {
|
|
41
|
-
setTimeout(function () {
|
|
42
|
-
dispatch(updateStep({
|
|
43
|
-
step: 2
|
|
44
|
-
}));
|
|
45
|
-
}, 4000);
|
|
46
|
-
}, []);
|
|
47
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
48
|
-
};
|
|
49
|
-
export var Card = function Card() {
|
|
50
|
-
var dispatch = useDispatch();
|
|
51
|
-
var _useContextData3 = useContextData(),
|
|
52
|
-
steps = _useContextData3.steps;
|
|
53
|
-
var _steps$3 = steps[2],
|
|
54
|
-
key = _steps$3.key,
|
|
55
|
-
props = _objectWithoutProperties(_steps$3, _excluded3);
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
setTimeout(function () {
|
|
58
|
-
dispatch(updateStep({
|
|
59
|
-
step: 3
|
|
60
|
-
}));
|
|
61
|
-
}, 200);
|
|
62
|
-
}, []);
|
|
63
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
64
|
-
};
|
|
65
|
-
export var Pwd = function Pwd() {
|
|
66
|
-
var dispatch = useDispatch();
|
|
67
|
-
var _useContextData4 = useContextData(),
|
|
68
|
-
steps = _useContextData4.steps;
|
|
69
|
-
var _steps$4 = steps[3],
|
|
70
|
-
key = _steps$4.key,
|
|
71
|
-
props = _objectWithoutProperties(_steps$4, _excluded4);
|
|
72
|
-
useEffect(function () {
|
|
73
|
-
setTimeout(function () {
|
|
74
|
-
dispatch(updateStep({
|
|
75
|
-
step: 4
|
|
76
|
-
}));
|
|
77
|
-
}, 200);
|
|
78
|
-
}, []);
|
|
79
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
80
|
-
};
|
|
81
|
-
//
|
|
82
|
-
export var Receipet = function Receipet() {
|
|
83
|
-
var dispatch = useDispatch();
|
|
84
|
-
var _useContextData5 = useContextData(),
|
|
85
|
-
steps = _useContextData5.steps;
|
|
86
|
-
var _steps$5 = steps[4],
|
|
87
|
-
key = _steps$5.key,
|
|
88
|
-
props = _objectWithoutProperties(_steps$5, _excluded5);
|
|
89
|
-
useEffect(function () {
|
|
90
|
-
setTimeout(function () {
|
|
91
|
-
dispatch(updateStep({
|
|
92
|
-
step: 5
|
|
93
|
-
}));
|
|
94
|
-
dispatch(updateStatus('warn'));
|
|
95
|
-
dispatch(updateWarn(locales.getText('page.eftpos-pay.text.receipt.again.text')));
|
|
96
|
-
}, 200);
|
|
97
|
-
}, []);
|
|
98
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
99
|
-
};
|
|
100
|
-
export var ReceipetAgain = function ReceipetAgain() {
|
|
101
|
-
var _useContextData6 = useContextData(),
|
|
102
|
-
steps = _useContextData6.steps;
|
|
103
|
-
var _steps$6 = steps[5],
|
|
104
|
-
key = _steps$6.key,
|
|
105
|
-
props = _objectWithoutProperties(_steps$6, _excluded6);
|
|
106
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
107
|
-
};
|
|
108
|
-
export var Wait = function Wait() {
|
|
109
|
-
var dispatch = useDispatch();
|
|
110
|
-
var _useContextData7 = useContextData(),
|
|
111
|
-
steps = _useContextData7.steps,
|
|
112
|
-
mode = _useContextData7.mode;
|
|
113
|
-
var _steps$7 = steps[6],
|
|
114
|
-
key = _steps$7.key,
|
|
115
|
-
props = _objectWithoutProperties(_steps$7, _excluded7);
|
|
116
|
-
useEffect(function () {
|
|
117
|
-
setTimeout(function () {
|
|
118
|
-
dispatch(updateNextStep());
|
|
119
|
-
}, 200);
|
|
120
|
-
}, []);
|
|
121
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
122
|
-
};
|
|
123
|
-
export var Action = function Action(_ref) {
|
|
124
|
-
var index = _ref.index;
|
|
125
|
-
var dispatch = useDispatch();
|
|
126
|
-
var data = useContextData();
|
|
127
|
-
var onCancel = function onCancel() {
|
|
128
|
-
dispatch(updateComponent('Fail'));
|
|
129
|
-
data.steps[index].fail = locales.getText('page.eftpos-pay.text.cancel');
|
|
130
|
-
dispatch(updateSteps(data.steps));
|
|
131
|
-
};
|
|
132
|
-
var onAccept = function onAccept() {
|
|
133
|
-
console.log('index 内 = ', index);
|
|
134
|
-
dispatch(updateNextStep());
|
|
135
|
-
};
|
|
136
|
-
var onDecline = function onDecline() {
|
|
137
|
-
dispatch(updateComponent('Signature'));
|
|
138
|
-
};
|
|
139
|
-
var onManually = function onManually() {
|
|
140
|
-
dispatch(updateState({
|
|
141
|
-
manual: {
|
|
142
|
-
title: locales.getText('page.eftpos-pay.text.request.title')(data.mode),
|
|
143
|
-
text: locales.getText('page.eftpos-pay.text.request.text')(data.mode)
|
|
144
|
-
}
|
|
145
|
-
}));
|
|
146
|
-
dispatch(updateComponent('Manual'));
|
|
147
|
-
};
|
|
148
|
-
if (index < 5) {
|
|
149
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
150
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
151
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
152
|
-
block: true,
|
|
153
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
154
|
-
onClick: onCancel
|
|
155
|
-
}, locales.getText('page.eftpos-pay.text.cancel')));
|
|
156
|
-
}
|
|
157
|
-
if (index === 5) {
|
|
158
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
159
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
160
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
161
|
-
block: true,
|
|
162
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
163
|
-
onClick: onDecline
|
|
164
|
-
}, locales.getText('page.eftpos-pay.text.decline')), /*#__PURE__*/React.createElement(Button, {
|
|
165
|
-
block: true,
|
|
166
|
-
type: "primary",
|
|
167
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
168
|
-
onClick: onAccept
|
|
169
|
-
}, locales.getText('page.eftpos-pay.text.accept')));
|
|
170
|
-
}
|
|
171
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
172
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
173
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
174
|
-
block: true,
|
|
175
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
176
|
-
onClick: onManually
|
|
177
|
-
}, locales.getText('page.eftpos-pay.text.manual.marking')));
|
|
178
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Amount } from '../const';
|
|
2
|
-
import { State } from '../store';
|
|
3
|
-
export declare const getStep: ({ amount, symbol, mode, }?: {
|
|
4
|
-
amount?: string | undefined;
|
|
5
|
-
symbol: string;
|
|
6
|
-
mode?: string | undefined;
|
|
7
|
-
}) => State['steps'];
|
|
8
|
-
declare const getInitState: (params: any) => State;
|
|
9
|
-
export default getInitState;
|
|
10
|
-
export declare function getAmonunt(store: State): Amount;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var _excluded = ["step", "steps"];
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
/* eslint-disable react/no-array-index-key */
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { StatusEnum } from "../const";
|
|
7
|
-
import { useContextData } from "../store";
|
|
8
|
-
import { POS, Surcharge, Card, Pwd, Receipet, ReceipetAgain, Wait, Action } from "./config";
|
|
9
|
-
export default (function (_ref) {
|
|
10
|
-
var api = _ref.api,
|
|
11
|
-
onChange = _ref.onChange,
|
|
12
|
-
children = _ref.children;
|
|
13
|
-
var _useContextData = useContextData(),
|
|
14
|
-
step = _useContextData.step,
|
|
15
|
-
steps = _useContextData.steps,
|
|
16
|
-
data = _objectWithoutProperties(_useContextData, _excluded);
|
|
17
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, steps.map(function (item, idx) {
|
|
18
|
-
var Comm;
|
|
19
|
-
if (idx === 0) Comm = POS;
|
|
20
|
-
if (idx === 1) Comm = Surcharge;
|
|
21
|
-
if (idx === 2) Comm = Card;
|
|
22
|
-
if (idx === 3) Comm = Pwd;
|
|
23
|
-
if (idx === 4) Comm = Receipet;
|
|
24
|
-
if (idx === 5) Comm = ReceipetAgain;
|
|
25
|
-
if (idx === 6) Comm = Wait;
|
|
26
|
-
if (!Comm) {
|
|
27
|
-
throw new Error('no comm');
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/React.createElement(Comm, {
|
|
30
|
-
key: "".concat(data.key, "-").concat(item.key, "-").concat(idx)
|
|
31
|
-
});
|
|
32
|
-
}), children, data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement(Action, {
|
|
33
|
-
index: step
|
|
34
|
-
}) : null);
|
|
35
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { locales } from '@pisell/utils';
|
|
8
|
-
import { Button } from 'antd';
|
|
9
|
-
import React, { useState } from 'react';
|
|
10
|
-
import { useContextData, useDispatch, updateNextStep, updateComponent, updateSteps, updateState } from "../store";
|
|
11
|
-
export default (function (_ref) {
|
|
12
|
-
var index = _ref.index,
|
|
13
|
-
api = _ref.api;
|
|
14
|
-
var _useState = useState(false),
|
|
15
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
-
disabled = _useState2[0],
|
|
17
|
-
setDisabled = _useState2[1];
|
|
18
|
-
var dispatch = useDispatch();
|
|
19
|
-
var data = useContextData();
|
|
20
|
-
var _useContextData = useContextData(),
|
|
21
|
-
custom = _useContextData.custom;
|
|
22
|
-
var onCancel = function onCancel() {
|
|
23
|
-
setDisabled(true);
|
|
24
|
-
api.update({
|
|
25
|
-
type: 'CANCEL',
|
|
26
|
-
number: custom === null || custom === void 0 ? void 0 : custom.number
|
|
27
|
-
}).then(function () {
|
|
28
|
-
dispatch(updateComponent('Fail'));
|
|
29
|
-
data.steps[index].status = 'fail';
|
|
30
|
-
data.steps[index].fail = locales.getText('page.eftpos-pay.text.cancel');
|
|
31
|
-
dispatch(updateSteps(data.steps));
|
|
32
|
-
setDisabled(false);
|
|
33
|
-
}).catch(function (res) {
|
|
34
|
-
console.log(res);
|
|
35
|
-
setDisabled(false);
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
var onAccept = function onAccept() {
|
|
39
|
-
setDisabled(true);
|
|
40
|
-
api.update({
|
|
41
|
-
type: 'YES',
|
|
42
|
-
number: custom === null || custom === void 0 ? void 0 : custom.number
|
|
43
|
-
}).then(function () {
|
|
44
|
-
setDisabled(false);
|
|
45
|
-
dispatch(updateNextStep());
|
|
46
|
-
}).catch(function (res) {
|
|
47
|
-
setDisabled(false);
|
|
48
|
-
console.log(res);
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
var onDecline = function onDecline() {
|
|
52
|
-
dispatch(updateComponent('Signature', true));
|
|
53
|
-
};
|
|
54
|
-
var onManually = function onManually() {
|
|
55
|
-
dispatch(updateState({
|
|
56
|
-
manual: {
|
|
57
|
-
title: locales.getText('page.eftpos-pay.text.request.title')(data.mode),
|
|
58
|
-
text: locales.getText('page.eftpos-pay.text.request.text')(data.mode)
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
dispatch(updateComponent('Manual', true));
|
|
62
|
-
};
|
|
63
|
-
if (index === 0) {
|
|
64
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
66
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
67
|
-
block: true,
|
|
68
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
69
|
-
onClick: onCancel,
|
|
70
|
-
disabled: disabled
|
|
71
|
-
}, locales.getText('page.eftpos-pay.text.cancel')));
|
|
72
|
-
}
|
|
73
|
-
if (index > 0 && index < 3) {
|
|
74
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
77
|
-
block: true,
|
|
78
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
79
|
-
disabled: true
|
|
80
|
-
}, locales.getText('page.eftpos-pay.text.leave')));
|
|
81
|
-
}
|
|
82
|
-
if (index === 3) {
|
|
83
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
85
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
86
|
-
block: true,
|
|
87
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
88
|
-
onClick: onDecline
|
|
89
|
-
}, locales.getText('page.eftpos-pay.text.decline')), /*#__PURE__*/React.createElement(Button, {
|
|
90
|
-
block: true,
|
|
91
|
-
type: "primary",
|
|
92
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
93
|
-
onClick: onAccept,
|
|
94
|
-
disabled: disabled
|
|
95
|
-
}, locales.getText('page.eftpos-pay.text.accept')));
|
|
96
|
-
}
|
|
97
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
className: "pisell-lowcode__eft-pay-step-item-btns"
|
|
99
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
100
|
-
block: true,
|
|
101
|
-
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
102
|
-
onClick: onManually
|
|
103
|
-
}, locales.getText('page.eftpos-pay.text.manual.marking')));
|
|
104
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PayStatus } from '../const';
|
|
2
|
-
export declare const useValidate: (timeout: number, changeStatus?: ((status: PayStatus) => void) | undefined) => readonly [(params: {
|
|
3
|
-
check: (...agrn: unknown[]) => Promise<any>;
|
|
4
|
-
number: number;
|
|
5
|
-
txn_status_id: string;
|
|
6
|
-
time?: number | undefined;
|
|
7
|
-
__start__?: string | undefined;
|
|
8
|
-
checkCondition(...agrn: unknown[]): boolean;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}>, () => void];
|
|
12
|
-
export declare const useSuccess: (index: number) => (res: {
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}, hasBackup?: boolean) => void;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var _excluded = ["step", "steps"];
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
/* eslint-disable consistent-return */
|
|
5
|
-
/* eslint-disable react/no-array-index-key */
|
|
6
|
-
/* eslint-disable array-callback-return */
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { StatusEnum } from "../const";
|
|
9
|
-
import { useContextData } from "../store";
|
|
10
|
-
import Action from "./action";
|
|
11
|
-
import POS from "./pos";
|
|
12
|
-
import Pwd from "./pwd";
|
|
13
|
-
import Receipet, { ReceipetAgain } from "./receipet";
|
|
14
|
-
import Wait from "./wait";
|
|
15
|
-
export default (function (_ref) {
|
|
16
|
-
var api = _ref.api,
|
|
17
|
-
onChange = _ref.onChange,
|
|
18
|
-
children = _ref.children,
|
|
19
|
-
hasBackup = _ref.hasBackup;
|
|
20
|
-
var _useContextData = useContextData(),
|
|
21
|
-
step = _useContextData.step,
|
|
22
|
-
steps = _useContextData.steps,
|
|
23
|
-
data = _objectWithoutProperties(_useContextData, _excluded);
|
|
24
|
-
console.log('hasBackup = ', hasBackup);
|
|
25
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: "pisell-lowcode__eft-pay-body"
|
|
27
|
-
}, steps.map(function (item, idx) {
|
|
28
|
-
var Comm;
|
|
29
|
-
if (idx === 0) Comm = POS;
|
|
30
|
-
if (idx === 1) Comm = Pwd;
|
|
31
|
-
if (idx === 2) Comm = Receipet;
|
|
32
|
-
if (idx === 3) Comm = ReceipetAgain;
|
|
33
|
-
if (idx === 4) Comm = Wait;
|
|
34
|
-
if (!Comm) {
|
|
35
|
-
throw new Error('no comm');
|
|
36
|
-
}
|
|
37
|
-
if (step >= idx) {
|
|
38
|
-
return /*#__PURE__*/React.createElement(Comm, {
|
|
39
|
-
key: "".concat(data.key, "-").concat(item.key, "-").concat(idx),
|
|
40
|
-
api: api,
|
|
41
|
-
hasBackup: hasBackup,
|
|
42
|
-
onChange: onChange
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}), children), data.status !== StatusEnum.Success ? /*#__PURE__*/React.createElement(Action, {
|
|
46
|
-
index: step,
|
|
47
|
-
api: api
|
|
48
|
-
}) : null);
|
|
49
|
-
});
|
|
@@ -1,180 +0,0 @@
|
|
|
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 = ["key"];
|
|
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
|
-
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
|
-
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; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
/* eslint-disable no-unused-vars */
|
|
17
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
18
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
19
|
-
import React, { useEffect, useRef } from 'react';
|
|
20
|
-
import Step from "../component/step";
|
|
21
|
-
import { StatusEnum } from "../const";
|
|
22
|
-
import { getUuid } from "../helper";
|
|
23
|
-
import { useFail } from "../hooks";
|
|
24
|
-
import { useContextData, useDispatch, updateState, updateCurrentCustomStemItem } from "../store";
|
|
25
|
-
import { useValidate, useSuccess } from "./hook";
|
|
26
|
-
var POS = function POS(_ref) {
|
|
27
|
-
var _props$custom, _props$custom3;
|
|
28
|
-
var api = _ref.api,
|
|
29
|
-
hasBackup = _ref.hasBackup;
|
|
30
|
-
var _useContextData = useContextData(),
|
|
31
|
-
steps = _useContextData.steps,
|
|
32
|
-
eftpos = _useContextData.eftpos,
|
|
33
|
-
device = _useContextData.device,
|
|
34
|
-
custom = _useContextData.custom,
|
|
35
|
-
status = _useContextData.status;
|
|
36
|
-
var statusRef = useRef(status);
|
|
37
|
-
var dispatch = useDispatch();
|
|
38
|
-
var _steps$ = steps[0],
|
|
39
|
-
key = _steps$.key,
|
|
40
|
-
props = _objectWithoutProperties(_steps$, _excluded);
|
|
41
|
-
var ref = useRef(custom === null || custom === void 0 ? void 0 : custom.number);
|
|
42
|
-
var stepStatusRef = useRef(props === null || props === void 0 ? void 0 : (_props$custom = props.custom) === null || _props$custom === void 0 ? void 0 : _props$custom.status);
|
|
43
|
-
var _useValidate = useValidate(1000 * 60),
|
|
44
|
-
_useValidate2 = _slicedToArray(_useValidate, 1),
|
|
45
|
-
check = _useValidate2[0];
|
|
46
|
-
var backupRef = useRef(hasBackup);
|
|
47
|
-
var fail = useFail(0);
|
|
48
|
-
var success = useSuccess(0);
|
|
49
|
-
var failRef = useRef(fail);
|
|
50
|
-
var successRef = useRef(success);
|
|
51
|
-
var controllerRef = useRef();
|
|
52
|
-
var customRef = useRef(custom);
|
|
53
|
-
var deviceRef = useRef(device);
|
|
54
|
-
var initRef = useRef(false);
|
|
55
|
-
var unloadRef = useRef(false);
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
statusRef.current = status;
|
|
58
|
-
}, [status]);
|
|
59
|
-
useEffect(function () {
|
|
60
|
-
customRef.current = custom;
|
|
61
|
-
}, [custom]);
|
|
62
|
-
useEffect(function () {
|
|
63
|
-
deviceRef.current = device;
|
|
64
|
-
}, [device]);
|
|
65
|
-
useEffect(function () {
|
|
66
|
-
var _props$custom2;
|
|
67
|
-
stepStatusRef.current = props === null || props === void 0 ? void 0 : (_props$custom2 = props.custom) === null || _props$custom2 === void 0 ? void 0 : _props$custom2.status;
|
|
68
|
-
}, [props === null || props === void 0 ? void 0 : (_props$custom3 = props.custom) === null || _props$custom3 === void 0 ? void 0 : _props$custom3.status]);
|
|
69
|
-
useEffect(function () {
|
|
70
|
-
backupRef.current = hasBackup;
|
|
71
|
-
}, [hasBackup]);
|
|
72
|
-
useEffect(function () {
|
|
73
|
-
failRef.current = fail;
|
|
74
|
-
}, [fail]);
|
|
75
|
-
useEffect(function () {
|
|
76
|
-
successRef.current = success;
|
|
77
|
-
}, [success]);
|
|
78
|
-
useEffect(function () {
|
|
79
|
-
if (initRef.current) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
initRef.current = true;
|
|
83
|
-
if (statusRef.current !== StatusEnum.Loading) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (!stepStatusRef.current) {
|
|
87
|
-
var _deviceRef$current;
|
|
88
|
-
ref.current = getUuid();
|
|
89
|
-
var _ref2 = customRef.current,
|
|
90
|
-
pay = _ref2.pay,
|
|
91
|
-
order_id = _ref2.order_id;
|
|
92
|
-
dispatch(updateState({
|
|
93
|
-
custom: _objectSpread(_objectSpread({}, customRef.current), {}, {
|
|
94
|
-
number: ref.current
|
|
95
|
-
})
|
|
96
|
-
}));
|
|
97
|
-
controllerRef.current = new AbortController();
|
|
98
|
-
api.pay({
|
|
99
|
-
order_id: order_id,
|
|
100
|
-
amount: pay.total,
|
|
101
|
-
card_reader_type: eftpos,
|
|
102
|
-
card_reader_id: (_deviceRef$current = deviceRef.current) === null || _deviceRef$current === void 0 ? void 0 : _deviceRef$current.id,
|
|
103
|
-
number: ref.current
|
|
104
|
-
}, {
|
|
105
|
-
signal: controllerRef.current.signal
|
|
106
|
-
}).then(function (res) {
|
|
107
|
-
if (unloadRef.current) {
|
|
108
|
-
return Promise.reject(res);
|
|
109
|
-
}
|
|
110
|
-
console.log('unloadRef.current = ', unloadRef.current);
|
|
111
|
-
if (res && (res.code === 200 || res.code === '200')) {
|
|
112
|
-
stepStatusRef.current = 'pay';
|
|
113
|
-
dispatch(updateCurrentCustomStemItem({
|
|
114
|
-
status: 'pay'
|
|
115
|
-
}));
|
|
116
|
-
return check({
|
|
117
|
-
check: api.check,
|
|
118
|
-
number: ref.current,
|
|
119
|
-
txn_status_id: '5',
|
|
120
|
-
__start__: '2',
|
|
121
|
-
checkCondition: function checkCondition(r) {
|
|
122
|
-
return Number(r.txn_status_id) < 5;
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return Promise.reject(res);
|
|
127
|
-
}, function (res) {
|
|
128
|
-
return Promise.reject(res);
|
|
129
|
-
}).then(function (res) {
|
|
130
|
-
if (unloadRef.current) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
console.log('unloadRef.current = ', unloadRef.current);
|
|
134
|
-
dispatch(updateCurrentCustomStemItem({
|
|
135
|
-
status: 'check'
|
|
136
|
-
}));
|
|
137
|
-
successRef.current(res, backupRef.current);
|
|
138
|
-
}, function (res) {
|
|
139
|
-
if (unloadRef.current) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
failRef.current(res, backupRef.current);
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (stepStatusRef.current === 'pay') {
|
|
147
|
-
check({
|
|
148
|
-
check: api.check,
|
|
149
|
-
number: ref.current,
|
|
150
|
-
txn_status_id: '5',
|
|
151
|
-
__start__: '2',
|
|
152
|
-
checkCondition: function checkCondition(r) {
|
|
153
|
-
return Number(r.txn_status_id) < 5;
|
|
154
|
-
}
|
|
155
|
-
}).then(function (res) {
|
|
156
|
-
if (unloadRef.current) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
dispatch(updateCurrentCustomStemItem({
|
|
160
|
-
status: 'check'
|
|
161
|
-
}));
|
|
162
|
-
successRef.current(res, backupRef.current);
|
|
163
|
-
}, function (res) {
|
|
164
|
-
if (unloadRef.current) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
failRef.current(res, backupRef.current);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}, [api, check, dispatch, eftpos]);
|
|
171
|
-
useEffect(function () {
|
|
172
|
-
return function () {
|
|
173
|
-
var _controllerRef$curren, _controllerRef$curren2;
|
|
174
|
-
unloadRef.current = true;
|
|
175
|
-
(_controllerRef$curren = controllerRef.current) === null || _controllerRef$curren === void 0 ? void 0 : (_controllerRef$curren2 = _controllerRef$curren.abort) === null || _controllerRef$curren2 === void 0 ? void 0 : _controllerRef$curren2.call(_controllerRef$curren);
|
|
176
|
-
};
|
|
177
|
-
}, []);
|
|
178
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
179
|
-
};
|
|
180
|
-
export default POS;
|