@pisell/private-materials 3.0.136 → 3.0.138
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/forms/single/index.js +3 -0
- 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/utils/load.d.ts +11 -0
- package/es/utils/load.js +85 -0
- package/lib/components/booking/forms/single/index.js +1 -0
- 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/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,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;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
var _excluded = ["key"];
|
|
2
|
-
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
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."); }
|
|
7
|
-
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); }
|
|
8
|
-
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; }
|
|
9
|
-
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; } }
|
|
10
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
/* eslint-disable no-unused-vars */
|
|
12
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
13
|
-
import { locales } from '@pisell/utils';
|
|
14
|
-
import React, { useEffect, useRef } from 'react';
|
|
15
|
-
import Step from "../component/step";
|
|
16
|
-
import { StatusEnum } from "../const";
|
|
17
|
-
import { useFail } from "../hooks";
|
|
18
|
-
import { useContextData, useDispatch, updateComponent, updateState, updateCurrentStemItem } from "../store";
|
|
19
|
-
import { useValidate, useSuccess } from "./hook";
|
|
20
|
-
var Pwd = function Pwd(_ref) {
|
|
21
|
-
var api = _ref.api,
|
|
22
|
-
hasBackup = _ref.hasBackup;
|
|
23
|
-
var dispatch = useDispatch();
|
|
24
|
-
var _useValidate = useValidate(1000 * 60),
|
|
25
|
-
_useValidate2 = _slicedToArray(_useValidate, 1),
|
|
26
|
-
check = _useValidate2[0];
|
|
27
|
-
var _useContextData = useContextData(),
|
|
28
|
-
custom = _useContextData.custom,
|
|
29
|
-
steps = _useContextData.steps,
|
|
30
|
-
status = _useContextData.status,
|
|
31
|
-
mode = _useContextData.mode;
|
|
32
|
-
console.log(steps);
|
|
33
|
-
var statusRef = useRef(status);
|
|
34
|
-
var ref = useRef(custom === null || custom === void 0 ? void 0 : custom.number);
|
|
35
|
-
var backupRef = useRef(hasBackup);
|
|
36
|
-
var initRef = useRef(false);
|
|
37
|
-
var fail = useFail(1, true);
|
|
38
|
-
var success = useSuccess(1);
|
|
39
|
-
var failRef = useRef(fail);
|
|
40
|
-
var successRef = useRef(success);
|
|
41
|
-
var unloadRef = useRef(false);
|
|
42
|
-
useEffect(function () {
|
|
43
|
-
failRef.current = fail;
|
|
44
|
-
}, [fail]);
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
successRef.current = success;
|
|
47
|
-
}, [success]);
|
|
48
|
-
useEffect(function () {
|
|
49
|
-
statusRef.current = status;
|
|
50
|
-
}, [status]);
|
|
51
|
-
var _steps$ = steps[1],
|
|
52
|
-
key = _steps$.key,
|
|
53
|
-
props = _objectWithoutProperties(_steps$, _excluded);
|
|
54
|
-
var stepStatusRef = useRef(props.status);
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
stepStatusRef.current = props.status;
|
|
57
|
-
}, [props.status]);
|
|
58
|
-
useEffect(function () {
|
|
59
|
-
ref.current = custom === null || custom === void 0 ? void 0 : custom.number;
|
|
60
|
-
}, [custom === null || custom === void 0 ? void 0 : custom.number]);
|
|
61
|
-
useEffect(function () {
|
|
62
|
-
statusRef.current = status;
|
|
63
|
-
}, [status]);
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
backupRef.current = hasBackup;
|
|
66
|
-
}, [hasBackup]);
|
|
67
|
-
useEffect(function () {
|
|
68
|
-
if (initRef.current) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
initRef.current = true;
|
|
72
|
-
if (statusRef.current !== StatusEnum.Loading) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (stepStatusRef.current !== StatusEnum.Loading) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (ref.current) {
|
|
79
|
-
console.log(' pwd 开始查询 ', ref.current, statusRef.current);
|
|
80
|
-
check({
|
|
81
|
-
check: api.check,
|
|
82
|
-
number: ref.current,
|
|
83
|
-
txn_status_id: '7',
|
|
84
|
-
__start__: '5',
|
|
85
|
-
checkCondition: function checkCondition(r) {
|
|
86
|
-
return Number(r.txn_status_id) < 7;
|
|
87
|
-
}
|
|
88
|
-
}).then(function (res) {
|
|
89
|
-
if (unloadRef.current) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
successRef.current(res, backupRef.current);
|
|
93
|
-
}, function (res) {
|
|
94
|
-
if (unloadRef.current) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (backupRef.current) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (res && _typeof(res) === 'object' && typeof res.txn_status_id !== 'undefined' && typeof res.status_id !== 'undefined') {
|
|
101
|
-
dispatch(updateCurrentStemItem({
|
|
102
|
-
status: 'fail'
|
|
103
|
-
}));
|
|
104
|
-
dispatch(updateState({
|
|
105
|
-
manual: {
|
|
106
|
-
title: locales.getText('page.eftpos-pay.text.timedout.title'),
|
|
107
|
-
text: locales.getText('page.eftpos-pay.text.timedout.text')(mode)
|
|
108
|
-
}
|
|
109
|
-
}));
|
|
110
|
-
dispatch(updateComponent('Manual'));
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
failRef.current(res, backupRef.current);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}, [api.check, check, dispatch]);
|
|
117
|
-
useEffect(function () {
|
|
118
|
-
return function () {
|
|
119
|
-
unloadRef.current = true;
|
|
120
|
-
};
|
|
121
|
-
}, []);
|
|
122
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
123
|
-
};
|
|
124
|
-
export default Pwd;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
var _excluded = ["key"],
|
|
2
|
-
_excluded2 = ["key"];
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
/* eslint-disable no-unused-vars */
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7
|
-
import React, { useEffect, useRef } from 'react';
|
|
8
|
-
import Step from "../component/step";
|
|
9
|
-
import { StatusEnum } from "../const";
|
|
10
|
-
import { useContextData, useDispatch, updateNextStep, updateSteps, updateStatus } from "../store";
|
|
11
|
-
var Receipet = function Receipet(_ref) {
|
|
12
|
-
var hasBackup = _ref.hasBackup;
|
|
13
|
-
var dispatch = useDispatch();
|
|
14
|
-
var _useContextData = useContextData(),
|
|
15
|
-
steps = _useContextData.steps,
|
|
16
|
-
status = _useContextData.status;
|
|
17
|
-
var _steps$ = steps[2],
|
|
18
|
-
key = _steps$.key,
|
|
19
|
-
props = _objectWithoutProperties(_steps$, _excluded);
|
|
20
|
-
var statusRef = useRef(status);
|
|
21
|
-
var stepStatusRef = useRef(props.status);
|
|
22
|
-
var backupRef = useRef(hasBackup);
|
|
23
|
-
var initRef = useRef(false);
|
|
24
|
-
var clearRef = useRef();
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
backupRef.current = hasBackup;
|
|
27
|
-
}, [hasBackup]);
|
|
28
|
-
useEffect(function () {
|
|
29
|
-
stepStatusRef.current = props.status;
|
|
30
|
-
}, [props.status]);
|
|
31
|
-
useEffect(function () {
|
|
32
|
-
if (initRef.current) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
initRef.current = true;
|
|
36
|
-
if (statusRef.current !== StatusEnum.Loading) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (stepStatusRef.current !== StatusEnum.Loading) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
clearRef.current = setTimeout(function () {
|
|
43
|
-
if (!backupRef.current) {
|
|
44
|
-
dispatch(updateNextStep());
|
|
45
|
-
dispatch(updateSteps(steps));
|
|
46
|
-
dispatch(updateStatus(StatusEnum.Warn));
|
|
47
|
-
}
|
|
48
|
-
}, 1000);
|
|
49
|
-
}, [dispatch, steps]);
|
|
50
|
-
useEffect(function () {
|
|
51
|
-
return function () {
|
|
52
|
-
if (clearRef.current) {
|
|
53
|
-
clearTimeout(clearRef.current);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}, []);
|
|
57
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
58
|
-
};
|
|
59
|
-
export var ReceipetAgain = function ReceipetAgain() {
|
|
60
|
-
var _useContextData2 = useContextData(),
|
|
61
|
-
steps = _useContextData2.steps;
|
|
62
|
-
var _steps$2 = steps[3],
|
|
63
|
-
key = _steps$2.key,
|
|
64
|
-
props = _objectWithoutProperties(_steps$2, _excluded2);
|
|
65
|
-
return /*#__PURE__*/React.createElement(Step, props);
|
|
66
|
-
};
|
|
67
|
-
export default Receipet;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StatusEnum } from '../const';
|
|
3
|
-
declare const Wait: ({ api, onChange, hasBackup, }: {
|
|
4
|
-
api: {
|
|
5
|
-
[key: string]: (...agrn: unknown[]) => Promise<unknown>;
|
|
6
|
-
};
|
|
7
|
-
onChange: (status: `${StatusEnum.Success}` | `${StatusEnum.Fail}`, params?: {
|
|
8
|
-
[keys: string]: unknown;
|
|
9
|
-
} | undefined) => void;
|
|
10
|
-
hasBackup: boolean;
|
|
11
|
-
}) => React.JSX.Element;
|
|
12
|
-
export default Wait;
|