@pisell/private-materials 3.0.95 → 3.0.97
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 +16 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -8
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/forms/forms.d.ts +1 -1
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/index.d.ts +1 -1
- package/es/components/booking/info/model.d.ts +1 -2
- package/es/components/booking/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/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/eftpos/const.d.ts +38 -0
- package/es/components/eftpos/const.js +79 -0
- package/es/components/eftpos/device.d.ts +8 -0
- package/es/components/eftpos/device.js +30 -0
- package/es/components/eftpos/form/index.d.ts +16 -0
- package/es/components/eftpos/form/index.js +113 -0
- package/es/components/eftpos/index.d.ts +37 -0
- package/es/components/eftpos/index.js +274 -0
- package/es/components/eftpos/index.less +153 -0
- package/es/components/eftpos/locales.d.ts +75 -0
- package/es/components/eftpos/locales.js +98 -0
- package/es/components/eftpos/pos.d.ts +9 -0
- package/es/components/eftpos/pos.js +33 -0
- package/es/components/eftpos/surcharge/index.css +17 -0
- package/es/components/eftpos/surcharge/index.d.ts +8 -0
- package/es/components/eftpos/surcharge/index.js +111 -0
- package/es/components/eftpos/table.d.ts +17 -0
- package/es/components/eftpos/table.js +236 -0
- package/es/components/eftposPay/amount.d.ts +14 -0
- package/es/components/eftposPay/amount.js +253 -0
- package/es/components/eftposPay/component/alert/index.d.ts +6 -0
- package/es/components/eftposPay/component/alert/index.js +11 -0
- package/es/components/eftposPay/component/alert/index.less +29 -0
- package/es/components/eftposPay/component/alert/warn.d.ts +3 -0
- package/es/components/eftposPay/component/alert/warn.js +45 -0
- package/es/components/eftposPay/component/fail/failCustom.d.ts +4 -0
- package/es/components/eftposPay/component/fail/failCustom.js +95 -0
- package/es/components/eftposPay/component/fail/index.d.ts +4 -0
- package/es/components/eftposPay/component/fail/index.js +105 -0
- package/es/components/eftposPay/component/fail/network.d.ts +4 -0
- package/es/components/eftposPay/component/fail/network.js +48 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +4 -0
- package/es/components/eftposPay/component/fail/unknow.js +43 -0
- package/es/components/eftposPay/component/header/index.d.ts +9 -0
- package/es/components/eftposPay/component/header/index.js +66 -0
- package/es/components/eftposPay/component/header/index.less +44 -0
- package/es/components/eftposPay/component/header/titlebar.d.ts +13 -0
- package/es/components/eftposPay/component/header/titlebar.js +39 -0
- package/es/components/eftposPay/component/header/titlebar.less +17 -0
- package/es/components/eftposPay/component/manual/index.d.ts +5 -0
- package/es/components/eftposPay/component/manual/index.js +91 -0
- package/es/components/eftposPay/component/manual/index.less +96 -0
- package/es/components/eftposPay/component/signature/index.d.ts +4 -0
- package/es/components/eftposPay/component/signature/index.js +63 -0
- package/es/components/eftposPay/component/step/index.d.ts +12 -0
- package/es/components/eftposPay/component/step/index.js +31 -0
- package/es/components/eftposPay/component/step/step.d.ts +9 -0
- package/es/components/eftposPay/component/step/step.js +23 -0
- package/es/components/eftposPay/const.d.ts +131 -0
- package/es/components/eftposPay/const.js +48 -0
- package/es/components/eftposPay/device.d.ts +14 -0
- package/es/components/eftposPay/device.js +124 -0
- package/es/components/eftposPay/device.less +61 -0
- package/es/components/eftposPay/eftpos/config.d.ts +11 -0
- package/es/components/eftposPay/eftpos/config.js +178 -0
- package/es/components/eftposPay/eftpos/const.d.ts +10 -0
- package/es/components/eftposPay/eftpos/const.js +139 -0
- package/es/components/eftposPay/eftpos/index.d.ts +7 -0
- package/es/components/eftposPay/eftpos/index.js +35 -0
- package/es/components/eftposPay/helper.d.ts +3 -0
- package/es/components/eftposPay/helper.js +35 -0
- package/es/components/eftposPay/hooks.d.ts +4 -0
- package/es/components/eftposPay/hooks.js +153 -0
- package/es/components/eftposPay/index.d.ts +7 -0
- package/es/components/eftposPay/index.js +188 -0
- package/es/components/eftposPay/index.less +273 -0
- package/es/components/eftposPay/locales.d.ts +264 -0
- package/es/components/eftposPay/locales.js +384 -0
- package/es/components/eftposPay/manufacturer.d.ts +6 -0
- package/es/components/eftposPay/manufacturer.js +32 -0
- package/es/components/eftposPay/pay.d.ts +10 -0
- package/es/components/eftposPay/pay.js +108 -0
- package/es/components/eftposPay/payo/config.d.ts +11 -0
- package/es/components/eftposPay/payo/config.js +357 -0
- package/es/components/eftposPay/payo/const.d.ts +6 -0
- package/es/components/eftposPay/payo/const.js +93 -0
- package/es/components/eftposPay/payo/hooks.d.ts +5 -0
- package/es/components/eftposPay/payo/hooks.js +84 -0
- package/es/components/eftposPay/payo/index.d.ts +7 -0
- package/es/components/eftposPay/payo/index.js +35 -0
- package/es/components/eftposPay/store/index.d.ts +239 -0
- package/es/components/eftposPay/store/index.js +304 -0
- package/es/components/eftposPay/store/useThunkReducer.d.ts +9 -0
- package/es/components/eftposPay/store/useThunkReducer.js +31 -0
- package/es/components/eftposPay/windcave/action.d.ts +8 -0
- package/es/components/eftposPay/windcave/action.js +104 -0
- package/es/components/eftposPay/windcave/const.d.ts +104 -0
- package/es/components/eftposPay/windcave/const.js +253 -0
- package/es/components/eftposPay/windcave/helper.d.ts +9 -0
- package/es/components/eftposPay/windcave/helper.js +314 -0
- package/es/components/eftposPay/windcave/hook.d.ts +14 -0
- package/es/components/eftposPay/windcave/hook.js +144 -0
- package/es/components/eftposPay/windcave/index.d.ts +8 -0
- package/es/components/eftposPay/windcave/index.js +49 -0
- package/es/components/eftposPay/windcave/pos.d.ts +8 -0
- package/es/components/eftposPay/windcave/pos.js +180 -0
- package/es/components/eftposPay/windcave/pwd.d.ts +8 -0
- package/es/components/eftposPay/windcave/pwd.js +124 -0
- package/es/components/eftposPay/windcave/receipet.d.ts +6 -0
- package/es/components/eftposPay/windcave/receipet.js +67 -0
- package/es/components/eftposPay/windcave/receiptAction.d.ts +11 -0
- package/es/components/eftposPay/windcave/receiptAction.js +326 -0
- package/es/components/eftposPay/windcave/timer.d.ts +17 -0
- package/es/components/eftposPay/windcave/timer.js +181 -0
- package/es/components/eftposPay/windcave/wait.d.ts +12 -0
- package/es/components/eftposPay/windcave/wait.js +139 -0
- package/es/components/eftposPay/windcave/windcave.d.ts +6 -0
- package/es/components/eftposPay/windcave/windcave.js +283 -0
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/es/hooks/usePrefix.d.ts +1 -0
- package/es/hooks/usePrefix.js +10 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/forms/forms.d.ts +1 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/index.d.ts +1 -1
- package/lib/components/booking/info/model.d.ts +1 -2
- package/lib/components/booking/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/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/eftpos/const.d.ts +38 -0
- package/lib/components/eftpos/const.js +108 -0
- package/lib/components/eftpos/device.d.ts +8 -0
- package/lib/components/eftpos/device.js +55 -0
- package/lib/components/eftpos/form/index.d.ts +16 -0
- package/lib/components/eftpos/form/index.js +124 -0
- package/lib/components/eftpos/index.d.ts +37 -0
- package/lib/components/eftpos/index.js +279 -0
- package/lib/components/eftpos/index.less +153 -0
- package/lib/components/eftpos/locales.d.ts +75 -0
- package/lib/components/eftpos/locales.js +116 -0
- package/lib/components/eftpos/pos.d.ts +9 -0
- package/lib/components/eftpos/pos.js +55 -0
- package/lib/components/eftpos/surcharge/index.css +17 -0
- package/lib/components/eftpos/surcharge/index.d.ts +8 -0
- package/lib/components/eftpos/surcharge/index.js +125 -0
- package/lib/components/eftpos/table.d.ts +17 -0
- package/lib/components/eftpos/table.js +235 -0
- package/lib/components/eftposPay/amount.d.ts +14 -0
- package/lib/components/eftposPay/amount.js +239 -0
- package/lib/components/eftposPay/component/alert/index.d.ts +6 -0
- package/lib/components/eftposPay/component/alert/index.js +38 -0
- package/lib/components/eftposPay/component/alert/index.less +29 -0
- package/lib/components/eftposPay/component/alert/warn.d.ts +3 -0
- package/lib/components/eftposPay/component/alert/warn.js +80 -0
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/failCustom.js +117 -0
- package/lib/components/eftposPay/component/fail/index.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/index.js +121 -0
- package/lib/components/eftposPay/component/fail/network.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/network.js +65 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +4 -0
- package/lib/components/eftposPay/component/fail/unknow.js +72 -0
- package/lib/components/eftposPay/component/header/index.d.ts +9 -0
- package/lib/components/eftposPay/component/header/index.js +92 -0
- package/lib/components/eftposPay/component/header/index.less +44 -0
- package/lib/components/eftposPay/component/header/titlebar.d.ts +13 -0
- package/lib/components/eftposPay/component/header/titlebar.js +55 -0
- package/lib/components/eftposPay/component/header/titlebar.less +17 -0
- package/lib/components/eftposPay/component/manual/index.d.ts +5 -0
- package/lib/components/eftposPay/component/manual/index.js +101 -0
- package/lib/components/eftposPay/component/manual/index.less +96 -0
- package/lib/components/eftposPay/component/signature/index.d.ts +4 -0
- package/lib/components/eftposPay/component/signature/index.js +80 -0
- package/lib/components/eftposPay/component/step/index.d.ts +12 -0
- package/lib/components/eftposPay/component/step/index.js +71 -0
- package/lib/components/eftposPay/component/step/step.d.ts +9 -0
- package/lib/components/eftposPay/component/step/step.js +59 -0
- package/lib/components/eftposPay/const.d.ts +131 -0
- package/lib/components/eftposPay/const.js +86 -0
- package/lib/components/eftposPay/device.d.ts +14 -0
- package/lib/components/eftposPay/device.js +127 -0
- package/lib/components/eftposPay/device.less +61 -0
- package/lib/components/eftposPay/eftpos/config.d.ts +11 -0
- package/lib/components/eftposPay/eftpos/config.js +199 -0
- package/lib/components/eftposPay/eftpos/const.d.ts +10 -0
- package/lib/components/eftposPay/eftpos/const.js +165 -0
- package/lib/components/eftposPay/eftpos/index.d.ts +7 -0
- package/lib/components/eftposPay/eftpos/index.js +66 -0
- package/lib/components/eftposPay/helper.d.ts +3 -0
- package/lib/components/eftposPay/helper.js +62 -0
- package/lib/components/eftposPay/hooks.d.ts +4 -0
- package/lib/components/eftposPay/hooks.js +237 -0
- package/lib/components/eftposPay/index.d.ts +7 -0
- package/lib/components/eftposPay/index.js +189 -0
- package/lib/components/eftposPay/index.less +273 -0
- package/lib/components/eftposPay/locales.d.ts +264 -0
- package/lib/components/eftposPay/locales.js +304 -0
- package/lib/components/eftposPay/manufacturer.d.ts +6 -0
- package/lib/components/eftposPay/manufacturer.js +77 -0
- package/lib/components/eftposPay/pay.d.ts +10 -0
- package/lib/components/eftposPay/pay.js +120 -0
- package/lib/components/eftposPay/payo/config.d.ts +11 -0
- package/lib/components/eftposPay/payo/config.js +377 -0
- package/lib/components/eftposPay/payo/const.d.ts +6 -0
- package/lib/components/eftposPay/payo/const.js +112 -0
- package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
- package/lib/components/eftposPay/payo/hooks.js +80 -0
- package/lib/components/eftposPay/payo/index.d.ts +7 -0
- package/lib/components/eftposPay/payo/index.js +63 -0
- package/lib/components/eftposPay/store/index.d.ts +239 -0
- package/lib/components/eftposPay/store/index.js +371 -0
- package/lib/components/eftposPay/store/useThunkReducer.d.ts +9 -0
- package/lib/components/eftposPay/store/useThunkReducer.js +53 -0
- package/lib/components/eftposPay/windcave/action.d.ts +8 -0
- package/lib/components/eftposPay/windcave/action.js +143 -0
- package/lib/components/eftposPay/windcave/const.d.ts +104 -0
- package/lib/components/eftposPay/windcave/const.js +300 -0
- package/lib/components/eftposPay/windcave/helper.d.ts +9 -0
- package/lib/components/eftposPay/windcave/helper.js +378 -0
- package/lib/components/eftposPay/windcave/hook.d.ts +14 -0
- package/lib/components/eftposPay/windcave/hook.js +139 -0
- package/lib/components/eftposPay/windcave/index.d.ts +8 -0
- package/lib/components/eftposPay/windcave/index.js +78 -0
- package/lib/components/eftposPay/windcave/pos.d.ts +8 -0
- package/lib/components/eftposPay/windcave/pos.js +197 -0
- package/lib/components/eftposPay/windcave/pwd.d.ts +8 -0
- package/lib/components/eftposPay/windcave/pwd.js +143 -0
- package/lib/components/eftposPay/windcave/receipet.d.ts +6 -0
- package/lib/components/eftposPay/windcave/receipet.js +93 -0
- package/lib/components/eftposPay/windcave/receiptAction.d.ts +11 -0
- package/lib/components/eftposPay/windcave/receiptAction.js +386 -0
- package/lib/components/eftposPay/windcave/timer.d.ts +17 -0
- package/lib/components/eftposPay/windcave/timer.js +126 -0
- package/lib/components/eftposPay/windcave/wait.d.ts +12 -0
- package/lib/components/eftposPay/windcave/wait.js +163 -0
- package/lib/components/eftposPay/windcave/windcave.d.ts +6 -0
- package/lib/components/eftposPay/windcave/windcave.js +283 -0
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/lib/hooks/usePrefix.d.ts +1 -0
- package/lib/hooks/usePrefix.js +44 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lowcode/eftpos/meta.ts +187 -0
- package/lowcode/eftpos-pay/meta.ts +122 -0
- package/package.json +4 -3
|
@@ -0,0 +1,180 @@
|
|
|
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;
|
|
@@ -0,0 +1,124 @@
|
|
|
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;
|
|
@@ -0,0 +1,67 @@
|
|
|
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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ReceiptAction: ({ api, onChange, }: {
|
|
3
|
+
api: any;
|
|
4
|
+
onChange: (status: boolean) => void;
|
|
5
|
+
}) => React.JSX.Element;
|
|
6
|
+
declare const Action: ({ index, onCancel, disabled, }: {
|
|
7
|
+
index: number;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}) => React.JSX.Element | null;
|
|
11
|
+
export default Action;
|