@pisell/private-materials 6.6.62 → 6.6.63
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 +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/components/footer/amount.js +4 -3
- package/es/components/booking/components/footer/utils.js +10 -3
- package/es/components/booking/components/voucher/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +76 -8
- package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/es/components/booking/info2/service/editService/utils.js +16 -0
- package/es/components/booking/payments/index.js +1 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/es/components/eftpos/PairModal/hooks.js +67 -0
- package/es/components/eftpos/PairModal/index.d.ts +11 -0
- package/es/components/eftpos/PairModal/index.js +246 -0
- package/es/components/eftpos/PairModal/index.less +70 -0
- package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/Action.js +141 -0
- package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/es/components/eftpos/SettlementModal/index.js +135 -0
- package/es/components/eftpos/SettlementModal/index.less +33 -0
- package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/es/components/eftpos/SettlementModal/serve.js +171 -0
- package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/es/components/eftpos/SettlementModal/types.js +35 -0
- package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/es/components/eftpos/SettlementModal/utils.js +351 -0
- package/es/components/eftpos/assets/mx51SCI.svg +15 -0
- package/es/components/eftpos/const.d.ts +3 -1
- package/es/components/eftpos/const.js +2 -0
- package/es/components/eftpos/device.d.ts +3 -1
- package/es/components/eftpos/device.js +14 -3
- package/es/components/eftpos/hooks.d.ts +13 -0
- package/es/components/eftpos/hooks.js +35 -0
- package/es/components/eftpos/index.js +198 -24
- package/es/components/eftpos/index.less +32 -1
- package/es/components/eftpos/locales.d.ts +80 -0
- package/es/components/eftpos/locales.js +205 -25
- package/es/components/eftpos/table.js +47 -3
- package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
- package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/es/components/eftposPay/aggregatePayment/index.js +2 -1
- package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
- package/es/components/eftposPay/aggregatePayment/service.js +1 -0
- package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/es/components/eftposPay/aggregatePayment/types.js +4 -8
- package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
- package/es/components/eftposPay/amount.js +15 -1
- package/es/components/eftposPay/app.js +2 -3
- package/es/components/eftposPay/component/fail/failCustom.js +13 -4
- package/es/components/eftposPay/component/fail/index.js +12 -5
- package/es/components/eftposPay/component/fail/network.js +3 -0
- package/es/components/eftposPay/component/fail/unknow.js +8 -0
- package/es/components/eftposPay/component/manual/index.js +17 -3
- package/es/components/eftposPay/component/signature/index.js +3 -0
- package/es/components/eftposPay/const.d.ts +8 -3
- package/es/components/eftposPay/const.js +2 -0
- package/es/components/eftposPay/device.js +225 -38
- package/es/components/eftposPay/helper.d.ts +3 -0
- package/es/components/eftposPay/helper.js +2 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.js +50 -13
- package/es/components/eftposPay/linkly/const.js +1 -1
- package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
- package/es/components/eftposPay/linkly/index.js +11 -23
- package/es/components/eftposPay/locales.d.ts +15 -0
- package/es/components/eftposPay/locales.js +30 -15
- package/es/components/eftposPay/manufacturer.d.ts +1 -0
- package/es/components/eftposPay/manufacturer.js +4 -0
- package/es/components/eftposPay/mx51/Action.d.ts +6 -0
- package/es/components/eftposPay/mx51/Action.js +144 -0
- package/es/components/eftposPay/mx51/const.d.ts +5 -0
- package/es/components/eftposPay/mx51/const.js +69 -0
- package/es/components/eftposPay/mx51/index.d.ts +6 -0
- package/es/components/eftposPay/mx51/index.js +498 -0
- package/es/components/eftposPay/mx51/types.d.ts +142 -0
- package/es/components/eftposPay/mx51/types.js +35 -0
- package/es/components/eftposPay/mx51/utils.d.ts +10 -0
- package/es/components/eftposPay/mx51/utils.js +121 -0
- package/es/components/eftposPay/pay.js +21 -9
- package/es/components/eftposPay/payo/config.js +39 -5
- package/es/components/eftposPay/payo/const.js +1 -1
- package/es/components/eftposPay/payo/hooks.js +3 -12
- package/es/components/eftposPay/payo/payment.js +69 -136
- package/es/components/eftposPay/store/index.d.ts +4 -8
- package/es/components/eftposPay/tip.js +5 -0
- package/es/components/eftposPay/tyro/const.js +1 -1
- package/es/components/eftposPay/tyro/index.js +44 -11
- package/es/components/eftposPay/utils/payLog.d.ts +81 -0
- package/es/components/eftposPay/utils/payLog.js +458 -0
- package/es/components/eftposPay/windcave/const.js +1 -1
- package/es/components/eftposPay/windcave/receiptAction.js +5 -0
- package/es/components/eftposPay/windcave/windcave.js +37 -38
- package/lib/components/booking/components/footer/amount.js +3 -3
- package/lib/components/booking/components/footer/utils.js +12 -5
- package/lib/components/booking/components/voucher/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +56 -5
- package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
- package/lib/components/booking/info2/service/editService/utils.js +16 -0
- package/lib/components/booking/payments/index.js +1 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
- package/lib/components/eftpos/PairModal/hooks.js +70 -0
- package/lib/components/eftpos/PairModal/index.d.ts +11 -0
- package/lib/components/eftpos/PairModal/index.js +197 -0
- package/lib/components/eftpos/PairModal/index.less +70 -0
- package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/Action.js +153 -0
- package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
- package/lib/components/eftpos/SettlementModal/index.js +170 -0
- package/lib/components/eftpos/SettlementModal/index.less +33 -0
- package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
- package/lib/components/eftpos/SettlementModal/serve.js +45 -0
- package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
- package/lib/components/eftpos/SettlementModal/types.js +43 -0
- package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
- package/lib/components/eftpos/SettlementModal/utils.js +248 -0
- package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
- package/lib/components/eftpos/const.d.ts +3 -1
- package/lib/components/eftpos/const.js +2 -0
- package/lib/components/eftpos/device.d.ts +3 -1
- package/lib/components/eftpos/device.js +13 -3
- package/lib/components/eftpos/hooks.d.ts +13 -0
- package/lib/components/eftpos/hooks.js +30 -0
- package/lib/components/eftpos/index.js +121 -8
- package/lib/components/eftpos/index.less +32 -1
- package/lib/components/eftpos/locales.d.ts +80 -0
- package/lib/components/eftpos/locales.js +231 -21
- package/lib/components/eftpos/table.js +30 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
- package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
- package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
- package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
- package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
- package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
- package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
- package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
- package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
- package/lib/components/eftposPay/amount.js +13 -1
- package/lib/components/eftposPay/app.js +4 -5
- package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
- package/lib/components/eftposPay/component/fail/index.js +10 -2
- package/lib/components/eftposPay/component/fail/network.js +3 -0
- package/lib/components/eftposPay/component/fail/unknow.js +8 -0
- package/lib/components/eftposPay/component/manual/index.js +16 -2
- package/lib/components/eftposPay/component/signature/index.js +3 -0
- package/lib/components/eftposPay/const.d.ts +8 -3
- package/lib/components/eftposPay/const.js +2 -0
- package/lib/components/eftposPay/device.js +114 -25
- package/lib/components/eftposPay/helper.d.ts +3 -0
- package/lib/components/eftposPay/helper.js +2 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.js +38 -13
- package/lib/components/eftposPay/linkly/const.js +1 -1
- package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
- package/lib/components/eftposPay/linkly/index.js +8 -10
- package/lib/components/eftposPay/locales.d.ts +15 -0
- package/lib/components/eftposPay/locales.js +30 -15
- package/lib/components/eftposPay/manufacturer.d.ts +1 -0
- package/lib/components/eftposPay/manufacturer.js +6 -0
- package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
- package/lib/components/eftposPay/mx51/Action.js +154 -0
- package/lib/components/eftposPay/mx51/const.d.ts +5 -0
- package/lib/components/eftposPay/mx51/const.js +85 -0
- package/lib/components/eftposPay/mx51/index.d.ts +6 -0
- package/lib/components/eftposPay/mx51/index.js +433 -0
- package/lib/components/eftposPay/mx51/types.d.ts +142 -0
- package/lib/components/eftposPay/mx51/types.js +43 -0
- package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
- package/lib/components/eftposPay/mx51/utils.js +115 -0
- package/lib/components/eftposPay/pay.js +13 -3
- package/lib/components/eftposPay/payo/config.js +16 -8
- package/lib/components/eftposPay/payo/const.js +1 -1
- package/lib/components/eftposPay/payo/hooks.js +12 -10
- package/lib/components/eftposPay/payo/payment.js +31 -65
- package/lib/components/eftposPay/store/index.d.ts +4 -8
- package/lib/components/eftposPay/tip.js +5 -0
- package/lib/components/eftposPay/tyro/const.js +1 -1
- package/lib/components/eftposPay/tyro/index.js +21 -17
- package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
- package/lib/components/eftposPay/utils/payLog.js +321 -0
- package/lib/components/eftposPay/windcave/const.js +1 -1
- package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
- package/lib/components/eftposPay/windcave/windcave.js +27 -29
- package/package.json +2 -2
- package/es/components/eftposPay/utils/log/index.d.ts +0 -110
- package/es/components/eftposPay/utils/log/index.js +0 -371
- package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
- package/lib/components/eftposPay/utils/log/index.js +0 -294
|
@@ -4,6 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
7
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
11
|
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."); }
|
|
9
12
|
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,16 +14,18 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
11
14
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
16
|
import { locales } from '@pisell/utils';
|
|
14
|
-
import { useMount } from 'ahooks';
|
|
17
|
+
import { useMount, useUnmount } from 'ahooks';
|
|
15
18
|
import { Spin, message } from 'antd';
|
|
16
|
-
import React, { useState } from 'react';
|
|
19
|
+
import React, { useState, useRef } from 'react';
|
|
17
20
|
import Titlebar from "./component/header/titlebar";
|
|
18
|
-
import { ModeEnum } from "./const";
|
|
21
|
+
import { ModeEnum, EftposEnum } from "./const";
|
|
19
22
|
import { getPayAmonunt } from "./helper";
|
|
20
23
|
import ChevronRight from '@pisell/icon/es/ChevronRight';
|
|
21
24
|
import { useDispatch, useContextData, updateDevice, updateState } from "./store";
|
|
22
25
|
import { getAmonunt } from "./manufacturer";
|
|
23
26
|
import "./device.less";
|
|
27
|
+
import useEngineContext from "../../hooks/useEngineContext";
|
|
28
|
+
import payLog from "./utils/payLog";
|
|
24
29
|
|
|
25
30
|
/**
|
|
26
31
|
* @title: 设备选择页
|
|
@@ -45,11 +50,16 @@ export default (function (_ref) {
|
|
|
45
50
|
} : _ref$formatAmount,
|
|
46
51
|
_ref$containerStyle = _ref.containerStyle,
|
|
47
52
|
containerStyle = _ref$containerStyle === void 0 ? {} : _ref$containerStyle;
|
|
53
|
+
var context = useEngineContext();
|
|
54
|
+
var _ref2 = context.appHelper.utils || {},
|
|
55
|
+
isTerminal = _ref2.isTerminal,
|
|
56
|
+
interaction = _ref2.interaction;
|
|
48
57
|
var store = useContextData();
|
|
49
58
|
var device = store.device,
|
|
50
59
|
symbol = store.symbol,
|
|
51
60
|
mode = store.mode,
|
|
52
|
-
eftpos = store.eftpos
|
|
61
|
+
eftpos = store.eftpos,
|
|
62
|
+
order_id = store.order_id;
|
|
53
63
|
var _useState = useState(false),
|
|
54
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
65
|
loading = _useState2[0],
|
|
@@ -63,6 +73,7 @@ export default (function (_ref) {
|
|
|
63
73
|
list = _useState6[0],
|
|
64
74
|
setList = _useState6[1];
|
|
65
75
|
var dispatch = useDispatch();
|
|
76
|
+
var timerRef = useRef();
|
|
66
77
|
|
|
67
78
|
/**
|
|
68
79
|
* @title: 设备选择事件
|
|
@@ -71,6 +82,7 @@ export default (function (_ref) {
|
|
|
71
82
|
* @Date: 2024-08-20 13:02
|
|
72
83
|
*/
|
|
73
84
|
var onClick = function onClick(event) {
|
|
85
|
+
var _list$index;
|
|
74
86
|
if (!net) {
|
|
75
87
|
message.open({
|
|
76
88
|
key: 'net-warning',
|
|
@@ -79,11 +91,59 @@ export default (function (_ref) {
|
|
|
79
91
|
});
|
|
80
92
|
return;
|
|
81
93
|
}
|
|
82
|
-
var
|
|
83
|
-
index =
|
|
94
|
+
var _ref3 = [Number(event.currentTarget.dataset.index)],
|
|
95
|
+
index = _ref3[0];
|
|
96
|
+
payLog.log('手动选择设备', {
|
|
97
|
+
deviceId: (_list$index = list[index]) === null || _list$index === void 0 ? void 0 : _list$index.id,
|
|
98
|
+
index: index
|
|
99
|
+
});
|
|
84
100
|
setDevice(list[index]);
|
|
85
101
|
};
|
|
86
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @title 控制原生关闭按钮的显示与隐藏
|
|
105
|
+
* @description hide_close_button:隐藏关闭按钮 show_close_button:显示关闭按钮
|
|
106
|
+
* @param bool 是否显示关闭按钮
|
|
107
|
+
*/
|
|
108
|
+
var triggerCloseButton = function triggerCloseButton(bool) {
|
|
109
|
+
var _interaction$utils, _interaction$utils$po;
|
|
110
|
+
if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
|
|
114
|
+
module: 'pos',
|
|
115
|
+
key: 'other',
|
|
116
|
+
data: {
|
|
117
|
+
key: bool ? 'show_close_button' : 'hide_close_button'
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @title 隐藏原生关闭按钮,delay后再显示
|
|
124
|
+
* @description Terminal环境,进入设备列表页面初始化默认关闭原生弹窗的loading,5s后如果还是没有调用成功再放开
|
|
125
|
+
*/
|
|
126
|
+
var closeFirstWithDelayShow = function closeFirstWithDelayShow() {
|
|
127
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
128
|
+
if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
triggerCloseButton(false);
|
|
132
|
+
timerRef.current = setTimeout(function () {
|
|
133
|
+
triggerCloseButton(true);
|
|
134
|
+
}, 5000);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 清除定时器
|
|
139
|
+
*/
|
|
140
|
+
var clearTimer = function clearTimer() {
|
|
141
|
+
if (timerRef.current) {
|
|
142
|
+
clearTimeout(timerRef.current);
|
|
143
|
+
timerRef.current = undefined;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
87
147
|
/**
|
|
88
148
|
* @title: 初始化加载设备列表页
|
|
89
149
|
* @description: 初始化加载设备列表页 若只有一条数据 则直接进入下一步
|
|
@@ -91,13 +151,20 @@ export default (function (_ref) {
|
|
|
91
151
|
* @Date: 2024-08-20 13:02
|
|
92
152
|
*/
|
|
93
153
|
useMount(function () {
|
|
154
|
+
payLog.log('设备选择页展示');
|
|
94
155
|
setLoading(true);
|
|
156
|
+
closeFirstWithDelayShow();
|
|
95
157
|
api.getDeviceList({
|
|
96
158
|
type: eftpos,
|
|
97
159
|
status: 'paired'
|
|
98
160
|
}).then(function (res) {
|
|
161
|
+
clearTimer();
|
|
99
162
|
setLoading(false);
|
|
100
163
|
if (res && Array.isArray(res.list) && res.list.length > 0) {
|
|
164
|
+
payLog.log('设备列表加载成功', {
|
|
165
|
+
count: res.list.length,
|
|
166
|
+
hasDeviceNumber: !!device_number
|
|
167
|
+
});
|
|
101
168
|
if (device_number) {
|
|
102
169
|
var hostDeviceList = res.list.filter(function (item) {
|
|
103
170
|
var _item$setting;
|
|
@@ -109,6 +176,9 @@ export default (function (_ref) {
|
|
|
109
176
|
setDataStaus(true);
|
|
110
177
|
setList(setDeviceList(hostDeviceList));
|
|
111
178
|
if (hostDeviceList.length === 1) {
|
|
179
|
+
payLog.log('自动选择设备(device_number匹配)', {
|
|
180
|
+
device: hostDeviceList[0]
|
|
181
|
+
});
|
|
112
182
|
setDevice(hostDeviceList[0]);
|
|
113
183
|
}
|
|
114
184
|
return;
|
|
@@ -117,44 +187,155 @@ export default (function (_ref) {
|
|
|
117
187
|
setDataStaus(true);
|
|
118
188
|
setList(setDeviceList(res.list));
|
|
119
189
|
if (res.list.length === 1) {
|
|
190
|
+
payLog.log('自动选择设备(单设备)', {
|
|
191
|
+
device: res.list[0]
|
|
192
|
+
});
|
|
120
193
|
setDevice(res.list[0]);
|
|
194
|
+
} else {
|
|
195
|
+
// 存在多个设备时,等待用户选择,Terminal环境需要显示关闭按钮
|
|
196
|
+
triggerCloseButton(true);
|
|
121
197
|
}
|
|
122
198
|
return;
|
|
123
199
|
}
|
|
200
|
+
payLog.log('设备列表为空');
|
|
201
|
+
triggerCloseButton(true);
|
|
124
202
|
setDataStaus(false);
|
|
125
203
|
}, function () {
|
|
204
|
+
clearTimer();
|
|
205
|
+
payLog.log('设备列表加载失败');
|
|
206
|
+
triggerCloseButton(true);
|
|
126
207
|
setDataStaus(false);
|
|
127
208
|
setLoading(false);
|
|
128
209
|
});
|
|
129
210
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
211
|
+
useUnmount(function () {
|
|
212
|
+
timerRef.current && clearTimeout(timerRef.current);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 延时方法:先延时指定时间,然后执行异步检查
|
|
217
|
+
* @param time 延时时间(毫秒),默认 100ms
|
|
218
|
+
* @returns Promise<boolean> 检查结果
|
|
219
|
+
*/
|
|
220
|
+
var checkIsActiveWithDelay = /*#__PURE__*/function () {
|
|
221
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
222
|
+
var _interaction$utils2;
|
|
223
|
+
var time,
|
|
224
|
+
_interaction$utils3,
|
|
225
|
+
_interaction$utils3$a,
|
|
226
|
+
activeStatus,
|
|
227
|
+
_args = arguments;
|
|
228
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
229
|
+
while (1) switch (_context.prev = _context.next) {
|
|
230
|
+
case 0:
|
|
231
|
+
time = _args.length > 0 && _args[0] !== undefined ? _args[0] : 100;
|
|
232
|
+
if (isTerminal !== null && isTerminal !== void 0 && isTerminal()) {
|
|
233
|
+
_context.next = 3;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
return _context.abrupt("return", true);
|
|
237
|
+
case 3:
|
|
238
|
+
_context.next = 5;
|
|
239
|
+
return new Promise(function (resolve) {
|
|
240
|
+
return setTimeout(resolve, time);
|
|
241
|
+
});
|
|
242
|
+
case 5:
|
|
243
|
+
if (!(interaction !== null && interaction !== void 0 && (_interaction$utils2 = interaction.utils) !== null && _interaction$utils2 !== void 0 && _interaction$utils2.asyncDataManager)) {
|
|
244
|
+
_context.next = 16;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
_context.prev = 6;
|
|
248
|
+
_context.next = 9;
|
|
249
|
+
return interaction === null || interaction === void 0 || (_interaction$utils3 = interaction.utils) === null || _interaction$utils3 === void 0 || (_interaction$utils3$a = _interaction$utils3.asyncDataManager) === null || _interaction$utils3$a === void 0 ? void 0 : _interaction$utils3$a.call(_interaction$utils3, {
|
|
250
|
+
module: 'get',
|
|
251
|
+
key: 'pay_webview_active'
|
|
252
|
+
});
|
|
253
|
+
case 9:
|
|
254
|
+
activeStatus = _context.sent;
|
|
255
|
+
return _context.abrupt("return", activeStatus !== 'unActive');
|
|
256
|
+
case 13:
|
|
257
|
+
_context.prev = 13;
|
|
258
|
+
_context.t0 = _context["catch"](6);
|
|
259
|
+
return _context.abrupt("return", true);
|
|
260
|
+
case 16:
|
|
261
|
+
return _context.abrupt("return", true);
|
|
262
|
+
case 17:
|
|
263
|
+
case "end":
|
|
264
|
+
return _context.stop();
|
|
265
|
+
}
|
|
266
|
+
}, _callee, null, [[6, 13]]);
|
|
133
267
|
}));
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
268
|
+
return function checkIsActiveWithDelay() {
|
|
269
|
+
return _ref4.apply(this, arguments);
|
|
270
|
+
};
|
|
271
|
+
}();
|
|
272
|
+
var setDevice = /*#__PURE__*/function () {
|
|
273
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(device) {
|
|
274
|
+
var isActive, amonunt, pay;
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
276
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
payLog.setContext({
|
|
279
|
+
deviceId: device === null || device === void 0 ? void 0 : device.id
|
|
280
|
+
});
|
|
281
|
+
dispatch(updateDevice({
|
|
282
|
+
device: device
|
|
283
|
+
}));
|
|
284
|
+
if (typeof api.selectDevice === 'function') {
|
|
285
|
+
api.selectDevice(device);
|
|
286
|
+
}
|
|
287
|
+
if (!(typeof onChange === 'function')) {
|
|
288
|
+
_context2.next = 14;
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
if (!(mode === ModeEnum.Pay)) {
|
|
292
|
+
_context2.next = 13;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
// Terminal环境,进入支付页面之前需要先隐藏关闭按钮
|
|
296
|
+
triggerCloseButton(false);
|
|
297
|
+
// 由于js和原生通信存在延时,需要检查当前页面是否处于活跃状态,如果不在活跃状态,则不进行支付
|
|
298
|
+
_context2.next = 8;
|
|
299
|
+
return checkIsActiveWithDelay(100);
|
|
300
|
+
case 8:
|
|
301
|
+
isActive = _context2.sent;
|
|
302
|
+
if (isActive) {
|
|
303
|
+
_context2.next = 12;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
payLog.log('页面非活跃状态,阻断支付', {
|
|
307
|
+
order_id: order_id,
|
|
308
|
+
isActive: isActive
|
|
309
|
+
});
|
|
310
|
+
return _context2.abrupt("return");
|
|
311
|
+
case 12:
|
|
312
|
+
if (device.pay) {
|
|
313
|
+
dispatch(updateState({
|
|
314
|
+
pay: device.pay
|
|
315
|
+
}));
|
|
316
|
+
} else {
|
|
317
|
+
amonunt = getAmonunt(_objectSpread(_objectSpread({}, store), {}, {
|
|
318
|
+
device: device
|
|
319
|
+
}));
|
|
320
|
+
pay = getPayAmonunt(amonunt, function (total) {
|
|
321
|
+
return formatAmount(total, 2, symbol);
|
|
322
|
+
});
|
|
323
|
+
dispatch(updateState({
|
|
324
|
+
pay: pay
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
327
|
+
case 13:
|
|
328
|
+
onChange('page', mode === ModeEnum.FullPay ? 'amount' : 'pay');
|
|
329
|
+
case 14:
|
|
330
|
+
case "end":
|
|
331
|
+
return _context2.stop();
|
|
153
332
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
333
|
+
}, _callee2);
|
|
334
|
+
}));
|
|
335
|
+
return function setDevice(_x) {
|
|
336
|
+
return _ref5.apply(this, arguments);
|
|
337
|
+
};
|
|
338
|
+
}();
|
|
158
339
|
var setDeviceList = function setDeviceList(list) {
|
|
159
340
|
return list.map(function (item) {
|
|
160
341
|
var amonunt = getAmonunt(_objectSpread(_objectSpread({}, store), {}, {
|
|
@@ -180,9 +361,11 @@ export default (function (_ref) {
|
|
|
180
361
|
} : {}), containerStyle || {})
|
|
181
362
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
182
363
|
spinning: loading,
|
|
364
|
+
size: "large",
|
|
183
365
|
style: {
|
|
184
366
|
flex: 1,
|
|
185
|
-
overflow: 'auto'
|
|
367
|
+
overflow: 'auto',
|
|
368
|
+
minHeight: '200px'
|
|
186
369
|
}
|
|
187
370
|
}, /*#__PURE__*/React.createElement("div", {
|
|
188
371
|
style: {
|
|
@@ -190,10 +373,12 @@ export default (function (_ref) {
|
|
|
190
373
|
flexDirection: 'column',
|
|
191
374
|
gap: '10px'
|
|
192
375
|
}
|
|
193
|
-
}, list.map(function (
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
376
|
+
}, list.map(function (_ref6, index) {
|
|
377
|
+
var _connection$response;
|
|
378
|
+
var id = _ref6.id,
|
|
379
|
+
name = _ref6.name,
|
|
380
|
+
pay = _ref6.pay,
|
|
381
|
+
connection = _ref6.connection;
|
|
197
382
|
return /*#__PURE__*/React.createElement("div", {
|
|
198
383
|
key: id,
|
|
199
384
|
className: "pisell-lowcode__eft-pay-device ".concat(id === (device === null || device === void 0 ? void 0 : device.id) ? 'active' : ''),
|
|
@@ -209,7 +394,9 @@ export default (function (_ref) {
|
|
|
209
394
|
className: "pisell-lowcode__eft-pay-device-money"
|
|
210
395
|
}, pay.totalUnit), /*#__PURE__*/React.createElement("div", {
|
|
211
396
|
className: "pisell-lowcode__eft-pay-device-sucharge"
|
|
212
|
-
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(pay.surcharge), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", pay.surRate, "% +", ' ', formatAmount("".concat(pay.surMoney), 2, symbol), ")")
|
|
397
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(pay.surcharge), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", pay.surRate, "% +", ' ', formatAmount("".concat(pay.surMoney), 2, symbol), ")"), eftpos === EftposEnum.MX51 ? /*#__PURE__*/React.createElement("div", {
|
|
398
|
+
className: "pisell-lowcode__eft-pay-device-sucharge"
|
|
399
|
+
}, "Pairing ID: ", connection === null || connection === void 0 || (_connection$response = connection.response) === null || _connection$response === void 0 ? void 0 : _connection$response.pairing_id) : null)), /*#__PURE__*/React.createElement("div", {
|
|
213
400
|
style: {
|
|
214
401
|
flexShrink: 0
|
|
215
402
|
}
|
|
@@ -29,6 +29,7 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
29
29
|
amount?: undefined;
|
|
30
30
|
total?: undefined;
|
|
31
31
|
receipt?: undefined;
|
|
32
|
+
uniquePaymentNumber?: undefined;
|
|
32
33
|
} | {
|
|
33
34
|
cardReaderSurcharge: {};
|
|
34
35
|
surMoney: string;
|
|
@@ -51,6 +52,7 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
51
52
|
} | undefined;
|
|
52
53
|
order_id: string | number;
|
|
53
54
|
receipt: {};
|
|
55
|
+
uniquePaymentNumber: string | number | undefined;
|
|
54
56
|
} | {
|
|
55
57
|
amount: string | number;
|
|
56
58
|
total: string | number;
|
|
@@ -58,6 +60,7 @@ export declare const getPayParams: (data: Partial<Omit<State, key>> & Pick<State
|
|
|
58
60
|
order_id: string | number;
|
|
59
61
|
device?: undefined;
|
|
60
62
|
receipt?: undefined;
|
|
63
|
+
uniquePaymentNumber?: undefined;
|
|
61
64
|
};
|
|
62
65
|
export declare const limitDecimals: (value: any) => any;
|
|
63
66
|
/**
|
|
@@ -109,7 +109,8 @@ export var getPayParams = function getPayParams(data, statue) {
|
|
|
109
109
|
number: data.number,
|
|
110
110
|
device: data.device,
|
|
111
111
|
order_id: data.order_id,
|
|
112
|
-
receipt: (_data$device2 = data.device) !== null && _data$device2 !== void 0 && (_data$device2 = _data$device2.setting) !== null && _data$device2 !== void 0 && _data$device2.receipts ? [] : receipt
|
|
112
|
+
receipt: (_data$device2 = data.device) !== null && _data$device2 !== void 0 && (_data$device2 = _data$device2.setting) !== null && _data$device2 !== void 0 && _data$device2.receipts ? [] : receipt,
|
|
113
|
+
uniquePaymentNumber: data.number
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
return {
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"stripe" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "tyro" | "mx51" | "payo" | "windcave" | "linkly" | "huifu">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -26,14 +26,25 @@ import { getInitState } from "./manufacturer";
|
|
|
26
26
|
import { Provider } from "./store";
|
|
27
27
|
import "./index.less";
|
|
28
28
|
import { getLocale } from "../../utils/locales";
|
|
29
|
+
import payLog, { usePayLog } from "./utils/payLog";
|
|
29
30
|
locales.init(localeTexts, getLocale());
|
|
30
31
|
export default (function (props) {
|
|
31
|
-
var _context$appHelper, _store$getState, _props$
|
|
32
|
+
var _props$params, _context$appHelper, _props$params3, _store$getState, _props$params4, _props$params5;
|
|
32
33
|
var _useState = useState(props.type === EftposEnum.Tyro ? OrderEumn.Null : props.source === RestoreEumn.Restore ? OrderEumn.Restore : OrderEumn.Normal),
|
|
33
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
35
|
check = _useState2[0],
|
|
35
36
|
setCheckStatus = _useState2[1];
|
|
36
37
|
var context = useEngineContext();
|
|
38
|
+
usePayLog({
|
|
39
|
+
paymentType: props.type,
|
|
40
|
+
mode: props.mode || ModeEnum.Pay,
|
|
41
|
+
orderId: (_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.order_id,
|
|
42
|
+
extra: {
|
|
43
|
+
initialParams: (props === null || props === void 0 ? void 0 : props.params) || null,
|
|
44
|
+
initialSource: (props === null || props === void 0 ? void 0 : props.source) || '',
|
|
45
|
+
initialDevice: (props === null || props === void 0 ? void 0 : props.device) || null
|
|
46
|
+
}
|
|
47
|
+
});
|
|
37
48
|
var _useState3 = useState(0),
|
|
38
49
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
50
|
cardSurcharge = _useState4[0],
|
|
@@ -69,20 +80,30 @@ export default (function (props) {
|
|
|
69
80
|
store = _ref.store;
|
|
70
81
|
|
|
71
82
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
83
|
+
* 优先从 props.params.platform 中获取渠道信息,其次读取 storage 中的 channel 字段
|
|
84
|
+
* terminal: terminal 内嵌
|
|
85
|
+
* android_kiosk / kiosk: kiosk 内嵌
|
|
86
|
+
* 默认: web
|
|
74
87
|
*/
|
|
75
88
|
var channel = useMemo(function () {
|
|
76
|
-
var _storage$get;
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
var _props$params2, _storage$get;
|
|
90
|
+
if ((props === null || props === void 0 || (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.platform) === 'kiosk') {
|
|
91
|
+
return 'kiosk';
|
|
92
|
+
}
|
|
93
|
+
var rawChannel = (storage === null || storage === void 0 || (_storage$get = storage.get) === null || _storage$get === void 0 ? void 0 : _storage$get.call(storage, 'channel')) || '';
|
|
94
|
+
if (rawChannel === 'terminal') {
|
|
79
95
|
return 'terminal';
|
|
80
96
|
}
|
|
81
|
-
if (
|
|
97
|
+
if (rawChannel === 'android_kiosk') {
|
|
82
98
|
return 'kiosk';
|
|
83
99
|
}
|
|
84
100
|
return '';
|
|
85
|
-
}, []);
|
|
101
|
+
}, [props === null || props === void 0 || (_props$params3 = props.params) === null || _props$params3 === void 0 ? void 0 : _props$params3.platform, storage]);
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
payLog.setContext({
|
|
104
|
+
channel: channel || 'web'
|
|
105
|
+
});
|
|
106
|
+
}, [channel]);
|
|
86
107
|
|
|
87
108
|
// 是否是移动端,如果isWebPos为true,则表示非原生移动端场景
|
|
88
109
|
var isMobile = useMemo(function () {
|
|
@@ -128,8 +149,8 @@ export default (function (props) {
|
|
|
128
149
|
symbol: current
|
|
129
150
|
});
|
|
130
151
|
// 手动将 originalParams 添加到 State 根级别
|
|
131
|
-
return _objectSpread(_objectSpread({}, initState), {}, {
|
|
132
|
-
originalParams: props.params ||
|
|
152
|
+
return _objectSpread(_objectSpread({}, initState || {}), {}, {
|
|
153
|
+
originalParams: props.params || {}
|
|
133
154
|
});
|
|
134
155
|
}, [mode, props.params, props.type, symbol]);
|
|
135
156
|
var stateRef = useRef(state);
|
|
@@ -137,6 +158,11 @@ export default (function (props) {
|
|
|
137
158
|
stateRef.current = state;
|
|
138
159
|
}, [state]);
|
|
139
160
|
var onChangeStatus = useCallback(function (status, params, other) {
|
|
161
|
+
payLog.log('支付状态回调', {
|
|
162
|
+
status: status,
|
|
163
|
+
params: params,
|
|
164
|
+
other: other
|
|
165
|
+
});
|
|
140
166
|
props.onChangeStatus(status, params, other);
|
|
141
167
|
}, []);
|
|
142
168
|
var action = useMemo(function () {
|
|
@@ -172,11 +198,10 @@ export default (function (props) {
|
|
|
172
198
|
}, [mode, state]);
|
|
173
199
|
useEffect(function () {
|
|
174
200
|
document.body.id = 'body';
|
|
175
|
-
console.log('初始化 ........112218017777');
|
|
176
201
|
}, []);
|
|
177
202
|
|
|
178
203
|
// console.log('action = ', action);
|
|
179
|
-
console.log('props?.params?.device_number = ', props === null || props === void 0 || (_props$
|
|
204
|
+
console.log('props?.params?.device_number = ', props === null || props === void 0 || (_props$params4 = props.params) === null || _props$params4 === void 0 ? void 0 : _props$params4.device_number);
|
|
180
205
|
|
|
181
206
|
/**
|
|
182
207
|
* @title: api 接口 数据
|
|
@@ -193,12 +218,14 @@ export default (function (props) {
|
|
|
193
218
|
if (props.source === RestoreEumn.Restore || props.type === EftposEnum.Tyro) {
|
|
194
219
|
return;
|
|
195
220
|
}
|
|
221
|
+
payLog.log('交易检查:开始检查交易');
|
|
196
222
|
api.getTransaction({
|
|
197
223
|
order_id: stateRef.current.order_id,
|
|
198
224
|
card_reader_type: stateRef.current.eftpos,
|
|
199
225
|
receive_status: 'unprocessed'
|
|
200
226
|
}).then(function (res) {
|
|
201
227
|
if (!Array.isArray(res.data) || res.data.length === 0) {
|
|
228
|
+
payLog.log('交易检查:无未处理交易');
|
|
202
229
|
setCheckStatus(OrderEumn.Null);
|
|
203
230
|
return;
|
|
204
231
|
}
|
|
@@ -215,6 +242,9 @@ export default (function (props) {
|
|
|
215
242
|
return item.number;
|
|
216
243
|
});
|
|
217
244
|
if (latest.status === OrderEumn.Failed) {
|
|
245
|
+
payLog.log('交易检查:最新交易已失败', {
|
|
246
|
+
number: latest.number
|
|
247
|
+
});
|
|
218
248
|
setCheckStatus(latest.status);
|
|
219
249
|
onChangeStatus('mark_tx_processed', [].concat(_toConsumableArray(numberList), [latest.number]));
|
|
220
250
|
return;
|
|
@@ -236,8 +266,15 @@ export default (function (props) {
|
|
|
236
266
|
try {
|
|
237
267
|
var data = JSON.parse(decodeURIComponent(atob(decodeURIComponent(pay_param_base64))));
|
|
238
268
|
setHistory(data);
|
|
269
|
+
payLog.log('交易检查:发现待处理交易', {
|
|
270
|
+
status: latest.status,
|
|
271
|
+
number: latest.number
|
|
272
|
+
});
|
|
239
273
|
setCheckStatus(latest.status);
|
|
240
274
|
} catch (e) {
|
|
275
|
+
payLog.log('交易检查:解析交易数据失败', {
|
|
276
|
+
error: e
|
|
277
|
+
});
|
|
241
278
|
setCheckStatus(OrderEumn.Failed);
|
|
242
279
|
return;
|
|
243
280
|
}
|
|
@@ -272,7 +309,7 @@ export default (function (props) {
|
|
|
272
309
|
source: props.source,
|
|
273
310
|
tyroUrl: props.tyroUrl,
|
|
274
311
|
tyroVersion: props.tyroVersion,
|
|
275
|
-
device_number: props === null || props === void 0 || (_props$
|
|
312
|
+
device_number: props === null || props === void 0 || (_props$params5 = props.params) === null || _props$params5 === void 0 ? void 0 : _props$params5.device_number,
|
|
276
313
|
isMobile: isMobile,
|
|
277
314
|
formatAmount: formatAmount,
|
|
278
315
|
styles: props.styles
|
|
@@ -54,7 +54,7 @@ export default (function (params) {
|
|
|
54
54
|
status: StatusEnum.Loading,
|
|
55
55
|
steps: getStep(mode),
|
|
56
56
|
render: true,
|
|
57
|
-
client: client !== 'undefined' ? client : ClientEnum.Merchant,
|
|
57
|
+
client: client !== 'undefined' && client !== undefined ? client : ClientEnum.Merchant,
|
|
58
58
|
warn: '',
|
|
59
59
|
custom: other || {}
|
|
60
60
|
}, typeof net !== 'undefined' ? {
|