@pisell/private-materials 6.6.61 → 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.
Files changed (203) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/amount.js +4 -3
  12. package/es/components/booking/components/footer/utils.js +10 -3
  13. package/es/components/booking/components/voucher/index.js +1 -1
  14. package/es/components/booking/info2/service/editService/index.js +76 -8
  15. package/es/components/booking/info2/service/editService/utils.d.ts +1 -0
  16. package/es/components/booking/info2/service/editService/utils.js +16 -0
  17. package/es/components/booking/payments/index.js +1 -1
  18. package/es/components/eftpos/PairModal/hooks.d.ts +27 -0
  19. package/es/components/eftpos/PairModal/hooks.js +67 -0
  20. package/es/components/eftpos/PairModal/index.d.ts +11 -0
  21. package/es/components/eftpos/PairModal/index.js +246 -0
  22. package/es/components/eftpos/PairModal/index.less +70 -0
  23. package/es/components/eftpos/SettlementModal/Action.d.ts +7 -0
  24. package/es/components/eftpos/SettlementModal/Action.js +141 -0
  25. package/es/components/eftpos/SettlementModal/index.d.ts +7 -0
  26. package/es/components/eftpos/SettlementModal/index.js +135 -0
  27. package/es/components/eftpos/SettlementModal/index.less +33 -0
  28. package/es/components/eftpos/SettlementModal/serve.d.ts +8 -0
  29. package/es/components/eftpos/SettlementModal/serve.js +171 -0
  30. package/es/components/eftpos/SettlementModal/types.d.ts +138 -0
  31. package/es/components/eftpos/SettlementModal/types.js +35 -0
  32. package/es/components/eftpos/SettlementModal/utils.d.ts +18 -0
  33. package/es/components/eftpos/SettlementModal/utils.js +351 -0
  34. package/es/components/eftpos/assets/mx51SCI.svg +15 -0
  35. package/es/components/eftpos/const.d.ts +3 -1
  36. package/es/components/eftpos/const.js +2 -0
  37. package/es/components/eftpos/device.d.ts +3 -1
  38. package/es/components/eftpos/device.js +14 -3
  39. package/es/components/eftpos/hooks.d.ts +13 -0
  40. package/es/components/eftpos/hooks.js +35 -0
  41. package/es/components/eftpos/index.js +198 -24
  42. package/es/components/eftpos/index.less +32 -1
  43. package/es/components/eftpos/locales.d.ts +80 -0
  44. package/es/components/eftpos/locales.js +205 -25
  45. package/es/components/eftpos/table.js +47 -3
  46. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  47. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  48. package/es/components/eftposPay/aggregatePayment/hooks/usePayment.js +145 -0
  49. package/es/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  50. package/es/components/eftposPay/aggregatePayment/index.js +2 -1
  51. package/es/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  52. package/es/components/eftposPay/aggregatePayment/mock.js +567 -0
  53. package/es/components/eftposPay/aggregatePayment/service.js +1 -0
  54. package/es/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  55. package/es/components/eftposPay/aggregatePayment/types.js +4 -8
  56. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  57. package/es/components/eftposPay/aggregatePayment/utils/payment.js +231 -168
  58. package/es/components/eftposPay/amount.js +15 -1
  59. package/es/components/eftposPay/app.js +2 -3
  60. package/es/components/eftposPay/component/fail/failCustom.js +13 -4
  61. package/es/components/eftposPay/component/fail/index.js +12 -5
  62. package/es/components/eftposPay/component/fail/network.js +3 -0
  63. package/es/components/eftposPay/component/fail/unknow.js +8 -0
  64. package/es/components/eftposPay/component/manual/index.js +17 -3
  65. package/es/components/eftposPay/component/signature/index.js +3 -0
  66. package/es/components/eftposPay/const.d.ts +8 -3
  67. package/es/components/eftposPay/const.js +2 -0
  68. package/es/components/eftposPay/device.js +225 -38
  69. package/es/components/eftposPay/helper.d.ts +3 -0
  70. package/es/components/eftposPay/helper.js +2 -1
  71. package/es/components/eftposPay/hooks.d.ts +1 -1
  72. package/es/components/eftposPay/index.js +50 -13
  73. package/es/components/eftposPay/linkly/const.js +1 -1
  74. package/es/components/eftposPay/linkly/hooks/normal.js +21 -68
  75. package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +20 -81
  76. package/es/components/eftposPay/linkly/index.js +11 -23
  77. package/es/components/eftposPay/locales.d.ts +15 -0
  78. package/es/components/eftposPay/locales.js +30 -15
  79. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  80. package/es/components/eftposPay/manufacturer.js +4 -0
  81. package/es/components/eftposPay/mx51/Action.d.ts +6 -0
  82. package/es/components/eftposPay/mx51/Action.js +144 -0
  83. package/es/components/eftposPay/mx51/const.d.ts +5 -0
  84. package/es/components/eftposPay/mx51/const.js +69 -0
  85. package/es/components/eftposPay/mx51/index.d.ts +6 -0
  86. package/es/components/eftposPay/mx51/index.js +498 -0
  87. package/es/components/eftposPay/mx51/types.d.ts +142 -0
  88. package/es/components/eftposPay/mx51/types.js +35 -0
  89. package/es/components/eftposPay/mx51/utils.d.ts +10 -0
  90. package/es/components/eftposPay/mx51/utils.js +121 -0
  91. package/es/components/eftposPay/pay.js +21 -9
  92. package/es/components/eftposPay/payo/config.js +39 -5
  93. package/es/components/eftposPay/payo/const.js +1 -1
  94. package/es/components/eftposPay/payo/hooks.js +3 -12
  95. package/es/components/eftposPay/payo/payment.js +69 -136
  96. package/es/components/eftposPay/store/index.d.ts +5 -9
  97. package/es/components/eftposPay/tip.js +5 -0
  98. package/es/components/eftposPay/tyro/const.js +1 -1
  99. package/es/components/eftposPay/tyro/index.js +44 -11
  100. package/es/components/eftposPay/utils/payLog.d.ts +81 -0
  101. package/es/components/eftposPay/utils/payLog.js +458 -0
  102. package/es/components/eftposPay/windcave/const.js +1 -1
  103. package/es/components/eftposPay/windcave/receiptAction.js +5 -0
  104. package/es/components/eftposPay/windcave/windcave.js +37 -38
  105. package/es/components/ticketBooking/utils/formatProductMessage.js +47 -2
  106. package/lib/components/booking/components/footer/amount.js +3 -3
  107. package/lib/components/booking/components/footer/utils.js +12 -5
  108. package/lib/components/booking/components/voucher/index.js +1 -1
  109. package/lib/components/booking/info2/service/editService/index.js +56 -5
  110. package/lib/components/booking/info2/service/editService/utils.d.ts +1 -0
  111. package/lib/components/booking/info2/service/editService/utils.js +16 -0
  112. package/lib/components/booking/payments/index.js +1 -1
  113. package/lib/components/eftpos/PairModal/hooks.d.ts +27 -0
  114. package/lib/components/eftpos/PairModal/hooks.js +70 -0
  115. package/lib/components/eftpos/PairModal/index.d.ts +11 -0
  116. package/lib/components/eftpos/PairModal/index.js +197 -0
  117. package/lib/components/eftpos/PairModal/index.less +70 -0
  118. package/lib/components/eftpos/SettlementModal/Action.d.ts +7 -0
  119. package/lib/components/eftpos/SettlementModal/Action.js +153 -0
  120. package/lib/components/eftpos/SettlementModal/index.d.ts +7 -0
  121. package/lib/components/eftpos/SettlementModal/index.js +170 -0
  122. package/lib/components/eftpos/SettlementModal/index.less +33 -0
  123. package/lib/components/eftpos/SettlementModal/serve.d.ts +8 -0
  124. package/lib/components/eftpos/SettlementModal/serve.js +45 -0
  125. package/lib/components/eftpos/SettlementModal/types.d.ts +138 -0
  126. package/lib/components/eftpos/SettlementModal/types.js +43 -0
  127. package/lib/components/eftpos/SettlementModal/utils.d.ts +18 -0
  128. package/lib/components/eftpos/SettlementModal/utils.js +248 -0
  129. package/lib/components/eftpos/assets/mx51SCI.svg +15 -0
  130. package/lib/components/eftpos/const.d.ts +3 -1
  131. package/lib/components/eftpos/const.js +2 -0
  132. package/lib/components/eftpos/device.d.ts +3 -1
  133. package/lib/components/eftpos/device.js +13 -3
  134. package/lib/components/eftpos/hooks.d.ts +13 -0
  135. package/lib/components/eftpos/hooks.js +30 -0
  136. package/lib/components/eftpos/index.js +121 -8
  137. package/lib/components/eftpos/index.less +32 -1
  138. package/lib/components/eftpos/locales.d.ts +80 -0
  139. package/lib/components/eftpos/locales.js +231 -21
  140. package/lib/components/eftpos/table.js +30 -2
  141. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +2 -2
  142. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.d.ts +8 -0
  143. package/lib/components/eftposPay/aggregatePayment/hooks/usePayment.js +171 -0
  144. package/lib/components/eftposPay/aggregatePayment/index.d.ts +2 -1
  145. package/lib/components/eftposPay/aggregatePayment/index.js +5 -2
  146. package/lib/components/eftposPay/aggregatePayment/mock.d.ts +495 -0
  147. package/lib/components/eftposPay/aggregatePayment/mock.js +679 -0
  148. package/lib/components/eftposPay/aggregatePayment/types.d.ts +12 -12
  149. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +13 -13
  150. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +173 -123
  151. package/lib/components/eftposPay/amount.js +13 -1
  152. package/lib/components/eftposPay/app.js +4 -5
  153. package/lib/components/eftposPay/component/fail/failCustom.js +10 -2
  154. package/lib/components/eftposPay/component/fail/index.js +10 -2
  155. package/lib/components/eftposPay/component/fail/network.js +3 -0
  156. package/lib/components/eftposPay/component/fail/unknow.js +8 -0
  157. package/lib/components/eftposPay/component/manual/index.js +16 -2
  158. package/lib/components/eftposPay/component/signature/index.js +3 -0
  159. package/lib/components/eftposPay/const.d.ts +8 -3
  160. package/lib/components/eftposPay/const.js +2 -0
  161. package/lib/components/eftposPay/device.js +114 -25
  162. package/lib/components/eftposPay/helper.d.ts +3 -0
  163. package/lib/components/eftposPay/helper.js +2 -1
  164. package/lib/components/eftposPay/hooks.d.ts +1 -1
  165. package/lib/components/eftposPay/index.js +38 -13
  166. package/lib/components/eftposPay/linkly/const.js +1 -1
  167. package/lib/components/eftposPay/linkly/hooks/normal.js +22 -43
  168. package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +13 -65
  169. package/lib/components/eftposPay/linkly/index.js +8 -10
  170. package/lib/components/eftposPay/locales.d.ts +15 -0
  171. package/lib/components/eftposPay/locales.js +30 -15
  172. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  173. package/lib/components/eftposPay/manufacturer.js +6 -0
  174. package/lib/components/eftposPay/mx51/Action.d.ts +6 -0
  175. package/lib/components/eftposPay/mx51/Action.js +154 -0
  176. package/lib/components/eftposPay/mx51/const.d.ts +5 -0
  177. package/lib/components/eftposPay/mx51/const.js +85 -0
  178. package/lib/components/eftposPay/mx51/index.d.ts +6 -0
  179. package/lib/components/eftposPay/mx51/index.js +433 -0
  180. package/lib/components/eftposPay/mx51/types.d.ts +142 -0
  181. package/lib/components/eftposPay/mx51/types.js +43 -0
  182. package/lib/components/eftposPay/mx51/utils.d.ts +10 -0
  183. package/lib/components/eftposPay/mx51/utils.js +115 -0
  184. package/lib/components/eftposPay/pay.js +13 -3
  185. package/lib/components/eftposPay/payo/config.js +16 -8
  186. package/lib/components/eftposPay/payo/const.js +1 -1
  187. package/lib/components/eftposPay/payo/hooks.js +12 -10
  188. package/lib/components/eftposPay/payo/payment.js +31 -65
  189. package/lib/components/eftposPay/store/index.d.ts +5 -9
  190. package/lib/components/eftposPay/tip.js +5 -0
  191. package/lib/components/eftposPay/tyro/const.js +1 -1
  192. package/lib/components/eftposPay/tyro/index.js +21 -17
  193. package/lib/components/eftposPay/utils/payLog.d.ts +81 -0
  194. package/lib/components/eftposPay/utils/payLog.js +321 -0
  195. package/lib/components/eftposPay/windcave/const.js +1 -1
  196. package/lib/components/eftposPay/windcave/receiptAction.js +5 -0
  197. package/lib/components/eftposPay/windcave/windcave.js +27 -29
  198. package/lib/components/ticketBooking/utils/formatProductMessage.js +44 -2
  199. package/package.json +4 -4
  200. package/es/components/eftposPay/utils/log/index.d.ts +0 -110
  201. package/es/components/eftposPay/utils/log/index.js +0 -371
  202. package/lib/components/eftposPay/utils/log/index.d.ts +0 -110
  203. package/lib/components/eftposPay/utils/log/index.js +0 -294
@@ -0,0 +1,246 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ 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; }
3
+ 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); } }
4
+ 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); }); }; }
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(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; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React, { useState, useMemo } from 'react';
12
+ import { PisellModal, Icon } from '@pisell/materials';
13
+ import { locales } from '@pisell/utils';
14
+ import { useCheckPairRequest, useUnPairRequest } from "./hooks";
15
+ import "./index.less";
16
+ var PairModal = function PairModal(_ref) {
17
+ var visible = _ref.visible,
18
+ data = _ref.data,
19
+ onCancel = _ref.onCancel,
20
+ onCheck = _ref.onCheck,
21
+ onConfirm = _ref.onConfirm;
22
+ var _ref2 = data || {},
23
+ pairResponse = _ref2.pairResponse,
24
+ type = _ref2.type;
25
+ var _useState = useState(false),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ cancelLoading = _useState2[0],
28
+ setCancelLoading = _useState2[1];
29
+ var _useState3 = useState(false),
30
+ _useState4 = _slicedToArray(_useState3, 2),
31
+ okLoading = _useState4[0],
32
+ setOkLoading = _useState4[1];
33
+ var _useState5 = useState('pairing'),
34
+ _useState6 = _slicedToArray(_useState5, 2),
35
+ status = _useState6[0],
36
+ setStatus = _useState6[1];
37
+ var checkPairRequest = useCheckPairRequest();
38
+ var unPairRequest = useUnPairRequest();
39
+ var textInfo = useMemo(function () {
40
+ return locales.getText('page.eftpos.text.pair.modal.content.text-info')(status);
41
+ }, [status]);
42
+ var styleInfo = useMemo(function () {
43
+ switch (status) {
44
+ case 'pairing':
45
+ return {
46
+ border: '1px solid #FEC84B',
47
+ backgroundColor: '#FFFCF5',
48
+ iconColor: '#DC6803',
49
+ color: '#B54708',
50
+ circle1Border: '2px solid rgba(220, 104, 3, 0.1)',
51
+ circle2Border: '2px solid rgba(220, 104, 3, 0.5)'
52
+ };
53
+ case 'success':
54
+ return {
55
+ border: '1px solid #75E0A7',
56
+ backgroundColor: '#F6FEF9',
57
+ iconColor: '#079455',
58
+ color: '#067647',
59
+ circle1Border: '2px solid rgba(7, 148, 85, 0.1)',
60
+ circle2Border: '2px solid rgba(7, 148, 85, 0.5)'
61
+ };
62
+ case 'failed':
63
+ return {
64
+ border: '1px solid #FDA29B',
65
+ backgroundColor: '#FFFBFA',
66
+ iconColor: '#D92D20',
67
+ color: '#B42318',
68
+ circle1Border: '2px solid rgba(217, 45, 32, 0.1)',
69
+ circle2Border: '2px solid rgba(217, 45, 32, 0.5)'
70
+ };
71
+ }
72
+ }, [status]);
73
+ var _onCancel = /*#__PURE__*/function () {
74
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
77
+ case 0:
78
+ if (!(cancelLoading || okLoading)) {
79
+ _context.next = 2;
80
+ break;
81
+ }
82
+ return _context.abrupt("return");
83
+ case 2:
84
+ _context.prev = 2;
85
+ setCancelLoading(true);
86
+ _context.next = 6;
87
+ return unPairRequest.run({
88
+ type: type,
89
+ pair_response: pairResponse
90
+ });
91
+ case 6:
92
+ _context.next = 11;
93
+ break;
94
+ case 8:
95
+ _context.prev = 8;
96
+ _context.t0 = _context["catch"](2);
97
+ console.error('onCancel error =>', _context.t0);
98
+ case 11:
99
+ _context.prev = 11;
100
+ setCancelLoading(false);
101
+ return _context.finish(11);
102
+ case 14:
103
+ onCancel === null || onCancel === void 0 || onCancel();
104
+ case 15:
105
+ case "end":
106
+ return _context.stop();
107
+ }
108
+ }, _callee, null, [[2, 8, 11, 14]]);
109
+ }));
110
+ return function _onCancel() {
111
+ return _ref3.apply(this, arguments);
112
+ };
113
+ }();
114
+ var _onCheck = /*#__PURE__*/function () {
115
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
116
+ var response;
117
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
118
+ while (1) switch (_context2.prev = _context2.next) {
119
+ case 0:
120
+ _context2.prev = 0;
121
+ setOkLoading(true);
122
+ _context2.next = 4;
123
+ return checkPairRequest.run({
124
+ type: type,
125
+ pair_response: pairResponse
126
+ });
127
+ case 4:
128
+ response = _context2.sent;
129
+ if ((response === null || response === void 0 ? void 0 : response.code) == 200) {
130
+ setStatus('success');
131
+ } else {
132
+ setStatus('failed');
133
+ }
134
+ _context2.next = 12;
135
+ break;
136
+ case 8:
137
+ _context2.prev = 8;
138
+ _context2.t0 = _context2["catch"](0);
139
+ console.error('onCheck error =>', _context2.t0);
140
+ setStatus('failed');
141
+ case 12:
142
+ _context2.prev = 12;
143
+ setOkLoading(false);
144
+ return _context2.finish(12);
145
+ case 15:
146
+ case "end":
147
+ return _context2.stop();
148
+ }
149
+ }, _callee2, null, [[0, 8, 12, 15]]);
150
+ }));
151
+ return function _onCheck() {
152
+ return _ref4.apply(this, arguments);
153
+ };
154
+ }();
155
+ var _onOk = /*#__PURE__*/function () {
156
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
157
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
158
+ while (1) switch (_context3.prev = _context3.next) {
159
+ case 0:
160
+ if (!(cancelLoading || okLoading)) {
161
+ _context3.next = 2;
162
+ break;
163
+ }
164
+ return _context3.abrupt("return");
165
+ case 2:
166
+ if (!(status === 'pairing' || status === 'failed')) {
167
+ _context3.next = 8;
168
+ break;
169
+ }
170
+ _context3.next = 5;
171
+ return _onCheck();
172
+ case 5:
173
+ onCheck === null || onCheck === void 0 || onCheck();
174
+ _context3.next = 9;
175
+ break;
176
+ case 8:
177
+ if (status === 'success') {
178
+ onConfirm === null || onConfirm === void 0 || onConfirm();
179
+ }
180
+ case 9:
181
+ case "end":
182
+ return _context3.stop();
183
+ }
184
+ }, _callee3);
185
+ }));
186
+ return function _onOk() {
187
+ return _ref5.apply(this, arguments);
188
+ };
189
+ }();
190
+ return /*#__PURE__*/React.createElement(PisellModal, {
191
+ open: visible,
192
+ header: false,
193
+ maskClosable: false,
194
+ closable: false,
195
+ zIndex: 9999,
196
+ onCancel: _onCancel,
197
+ onOk: _onOk,
198
+ okText: textInfo.okButtonText,
199
+ cancelText: textInfo.cancenButtonText,
200
+ okButtonProps: {
201
+ loading: okLoading
202
+ },
203
+ cancelButtonProps: {
204
+ loading: cancelLoading
205
+ }
206
+ }, /*#__PURE__*/React.createElement("div", {
207
+ className: "pisell-lowcode__pos-device-pair-modal-content"
208
+ }, /*#__PURE__*/React.createElement("div", {
209
+ className: "pisell-lowcode__pos-device-pair-modal-content-top",
210
+ style: {
211
+ border: styleInfo.border,
212
+ backgroundColor: styleInfo.backgroundColor,
213
+ color: styleInfo.color
214
+ }
215
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
216
+ className: "pisell-lowcode__pos-device-pair-modal-content-top-circle-1",
217
+ style: {
218
+ border: styleInfo.circle1Border
219
+ }
220
+ }, /*#__PURE__*/React.createElement("div", {
221
+ className: "pisell-lowcode__pos-device-pair-modal-content-top-circle-2",
222
+ style: {
223
+ border: styleInfo.circle2Border
224
+ }
225
+ }, /*#__PURE__*/React.createElement(Icon, {
226
+ type: "pisell2-alert-circle",
227
+ size: 20,
228
+ style: {
229
+ color: styleInfo.iconColor,
230
+ opacity: 1
231
+ }
232
+ })))), /*#__PURE__*/React.createElement("div", {
233
+ className: "pisell-lowcode__pos-device-pair-modal-content-top-right"
234
+ }, /*#__PURE__*/React.createElement("div", {
235
+ className: "pisell-lowcode__pos-device-pair-modal-content-top-right-title"
236
+ }, textInfo.title), /*#__PURE__*/React.createElement("div", {
237
+ className: "pisell-lowcode__pos-device-pair-modal-content-top-right-description"
238
+ }, textInfo.description))), status !== 'success' && /*#__PURE__*/React.createElement("div", {
239
+ className: "pisell-lowcode__pos-device-pair-modal-content-code"
240
+ }, /*#__PURE__*/React.createElement("div", {
241
+ className: "pisell-lowcode__pos-device-pair-modal-content-code-title"
242
+ }, textInfo.codeTitle), /*#__PURE__*/React.createElement("div", {
243
+ className: "pisell-lowcode__pos-device-pair-modal-content-code-value"
244
+ }, (pairResponse === null || pairResponse === void 0 ? void 0 : pairResponse.confirmation_code) || '-'))));
245
+ };
246
+ export default PairModal;
@@ -0,0 +1,70 @@
1
+ .pisell-lowcode__pos-device-pair-modal-content {
2
+ padding: 20px 0;
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 20px;
6
+
7
+ &-top {
8
+ padding: 16px;
9
+ display: flex;
10
+ flex-direction: row;
11
+ gap: 8px;
12
+ border-radius: 12px;
13
+ box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
14
+
15
+ &-circle-1 {
16
+ margin: -8px 0 0 -8px;
17
+ width: 36px;
18
+ height: 36px;
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ border-radius: 50%;
23
+ }
24
+
25
+ &-circle-2 {
26
+ width: 28px;
27
+ height: 28px;
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ border-radius: 50%;
32
+ }
33
+
34
+ &-right {
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: 4px;
38
+
39
+ &-title {
40
+ font-size: 14px;
41
+ font-weight: 600;
42
+ }
43
+
44
+ &-description {
45
+ font-size: 14px;
46
+ font-weight: 400;
47
+ }
48
+ }
49
+ }
50
+
51
+ &-code {
52
+ display: flex;
53
+ flex-direction: column;
54
+ justify-content: center;
55
+ align-items: center;
56
+ gap: 8px;
57
+
58
+ &-title {
59
+ color: var(--Gray-700, #344054);
60
+ font-size: 14px;
61
+ font-weight: 600;
62
+ }
63
+
64
+ &-value {
65
+ color: var(--Gray-900, #101828);
66
+ font-size: 30px;
67
+ font-weight: 600;
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,7 @@
1
+ import './index.less';
2
+ /**
3
+ * @title 渲染动态内容
4
+ * @description 用于渲染从接口解析出来的元素
5
+ */
6
+ declare const Action: (props: any) => JSX.Element;
7
+ export default Action;
@@ -0,0 +1,141 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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
+ 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); }
10
+ 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; }
11
+ 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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import React, { useEffect, useState, useRef } from 'react';
14
+ import { Button, Input } from 'antd';
15
+ import "./index.less";
16
+
17
+ /**
18
+ * @title 渲染动态内容
19
+ * @description 用于渲染从接口解析出来的元素
20
+ */
21
+
22
+ var Action = function Action(props) {
23
+ var _data$layouts2, _data$layouts3;
24
+ var data = props.data,
25
+ _props$showMessage = props.showMessage,
26
+ showMessage = _props$showMessage === void 0 ? true : _props$showMessage;
27
+ var _useState = useState({}),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ inputValues = _useState2[0],
30
+ setInputValues = _useState2[1];
31
+ var inputValuesRef = useRef(inputValues);
32
+ useEffect(function () {
33
+ var _data$layouts;
34
+ if (!data) return;
35
+ var inputObj = {};
36
+ data === null || data === void 0 || (_data$layouts = data.layouts) === null || _data$layouts === void 0 || _data$layouts.forEach(function (item) {
37
+ var _item$elements;
38
+ item === null || item === void 0 || (_item$elements = item.elements) === null || _item$elements === void 0 || _item$elements.forEach(function (element) {
39
+ if ((element === null || element === void 0 ? void 0 : element.type) === 'input' && element !== null && element !== void 0 && element.name) {
40
+ inputObj[element === null || element === void 0 ? void 0 : element.name] = inputValuesRef.current[element === null || element === void 0 ? void 0 : element.name] || '';
41
+ }
42
+ });
43
+ });
44
+ setInputValues(inputObj);
45
+ }, [data]);
46
+ useEffect(function () {
47
+ inputValuesRef.current = inputValues;
48
+ }, [inputValues]);
49
+ var handleInputChange = function handleInputChange(key, value) {
50
+ setInputValues(function (prev) {
51
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, value));
52
+ });
53
+ };
54
+ return /*#__PURE__*/React.createElement(React.Fragment, null, showMessage && (data === null || data === void 0 ? void 0 : data.message) && /*#__PURE__*/React.createElement("div", {
55
+ className: "pisell-eftpos-settlement-modal-step-item"
56
+ }, data === null || data === void 0 ? void 0 : data.message), (data === null || data === void 0 || (_data$layouts2 = data.layouts) === null || _data$layouts2 === void 0 ? void 0 : _data$layouts2.length) > 0 && (data === null || data === void 0 || (_data$layouts3 = data.layouts) === null || _data$layouts3 === void 0 ? void 0 : _data$layouts3.map(function (item, index) {
57
+ var _item$elements2;
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ key: index,
60
+ className: "pisell-eftpos-settlement-modal-step-item-btns",
61
+ style: {
62
+ marginTop: '20px',
63
+ width: '100%',
64
+ display: 'flex',
65
+ justifyContent: 'center'
66
+ }
67
+ }, item === null || item === void 0 || (_item$elements2 = item.elements) === null || _item$elements2 === void 0 ? void 0 : _item$elements2.map(function (element) {
68
+ var key = element.key,
69
+ label = element.label,
70
+ type = element.type,
71
+ text = element.text,
72
+ name = element.name;
73
+ if (type === 'button') {
74
+ return /*#__PURE__*/React.createElement(Button, {
75
+ key: key + label,
76
+ block: true,
77
+ className: "pisell-eftpos-settlement-modal-step-item-btn",
78
+ onClick: function onClick() {
79
+ var _props$onClick;
80
+ return props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, element, {
81
+ inputValues: inputValues
82
+ });
83
+ }
84
+ }, element.label);
85
+ } else if (type === 'text') {
86
+ return /*#__PURE__*/React.createElement("div", {
87
+ key: key + label,
88
+ className: "pisell-eftpos-settlement-modal-step-item-tip"
89
+ }, label ? "".concat(label, ": ") : '', text || '');
90
+ } else if (type === 'image') {
91
+ var _ref = (element === null || element === void 0 ? void 0 : element.image) || {},
92
+ _name = _ref.name,
93
+ _data = _ref.data,
94
+ encoding = _ref.encoding;
95
+ var imageUrl = _data ? "data:".concat(_name || 'image/png', ";").concat(encoding || 'base64', ",").concat(_data) : '';
96
+ return /*#__PURE__*/React.createElement("div", {
97
+ style: {
98
+ width: '100%',
99
+ display: 'flex',
100
+ justifyContent: 'center'
101
+ }
102
+ }, /*#__PURE__*/React.createElement("img", {
103
+ key: key + label,
104
+ src: imageUrl,
105
+ alt: label
106
+ }));
107
+ } else if (type === 'input') {
108
+ return /*#__PURE__*/React.createElement("div", {
109
+ style: {
110
+ width: '100%',
111
+ display: 'flex',
112
+ alignItems: 'center',
113
+ flexWrap: 'wrap'
114
+ }
115
+ }, /*#__PURE__*/React.createElement("span", {
116
+ style: {
117
+ marginRight: '10px'
118
+ }
119
+ }, "".concat(label ? "".concat(label, " ") : '')), /*#__PURE__*/React.createElement(Input, {
120
+ key: key + label,
121
+ alt: label,
122
+ style: {
123
+ flex: 1,
124
+ minWidth: '200px'
125
+ },
126
+ value: inputValues[name] || '',
127
+ onChange: function onChange(e) {
128
+ return handleInputChange(name, e.target.value);
129
+ }
130
+ }));
131
+ }
132
+ return null;
133
+ }));
134
+ })), (data === null || data === void 0 ? void 0 : data.detailsText) && /*#__PURE__*/React.createElement("div", {
135
+ className: "pisell-eftpos-settlement-modal-step-item pisell-eftpos-settlement-modal-step-item-tip",
136
+ style: {
137
+ marginTop: '24px'
138
+ }
139
+ }, data === null || data === void 0 ? void 0 : data.detailsText));
140
+ };
141
+ export default Action;
@@ -0,0 +1,7 @@
1
+ import './index.less';
2
+ declare const SettlementModal: ({ open, onClose, data, }: {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ data: any;
6
+ }) => JSX.Element;
7
+ export default SettlementModal;
@@ -0,0 +1,135 @@
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(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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, useState } from 'react';
8
+ import { useMemoizedFn } from 'ahooks';
9
+ import { PisellModal } from '@pisell/materials';
10
+ import "./index.less";
11
+ import usePrefix from "../../../hooks/usePrefix";
12
+ import Action from "./Action";
13
+ import { EButtonKeyType, ESettlementStatus } from "./types";
14
+ import { parseMX51Params, settlementQuery } from "./utils";
15
+ import useEngineContext from "../../../hooks/useEngineContext";
16
+ var SettlementModal = function SettlementModal(_ref) {
17
+ var _context$appHelper;
18
+ var open = _ref.open,
19
+ onClose = _ref.onClose,
20
+ data = _ref.data;
21
+ var context = useEngineContext();
22
+ var prefix = usePrefix();
23
+ var _ref2 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
24
+ isTerminal = _ref2.isTerminal,
25
+ interaction = _ref2.interaction;
26
+ var _useState = useState(false),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ receiptModalShow = _useState2[0],
29
+ setReceiptModalShow = _useState2[1];
30
+ var _useState3 = useState(null),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ receiptModalData = _useState4[0],
33
+ setReceiptModalData = _useState4[1];
34
+ var _useState5 = useState(null),
35
+ _useState6 = _slicedToArray(_useState5, 2),
36
+ action = _useState6[0],
37
+ setAction = _useState6[1];
38
+ var _useState7 = useState(ESettlementStatus.Processing),
39
+ _useState8 = _slicedToArray(_useState7, 2),
40
+ status = _useState8[0],
41
+ setStatus = _useState8[1];
42
+ var runSettlementQuery = useMemoizedFn(function () {
43
+ setAction(null);
44
+ setStatus(ESettlementStatus.Processing);
45
+ console.log('settlementQuery_start');
46
+ settlementQuery(data, function (status, res) {
47
+ console.log('settlementQuery_callback', status, res);
48
+ var parsedData = parseMX51Params(res === null || res === void 0 ? void 0 : res.data, status, res);
49
+ console.log('settlementQuery_parsedData', parsedData);
50
+ if (parsedData) {
51
+ setAction(parsedData);
52
+ }
53
+ setStatus(status);
54
+ });
55
+ });
56
+ var onCloseReceiptModal = function onCloseReceiptModal() {
57
+ setReceiptModalData(null);
58
+ setReceiptModalShow(false);
59
+ };
60
+ var onElementClick = function onElementClick(element) {
61
+ console.log('onElementClick', element);
62
+ switch (element.key) {
63
+ case EButtonKeyType.SettlementComplete:
64
+ onClose();
65
+ break;
66
+ case EButtonKeyType.RetrySettlement:
67
+ runSettlementQuery();
68
+ break;
69
+ case EButtonKeyType.PrintMerchantReceipt:
70
+ var _isTerminal = typeof isTerminal === 'function' ? isTerminal() : false;
71
+ if (_isTerminal) {
72
+ var _interaction$utils, _interaction$utils$po;
73
+ var receipt = element !== null && element !== void 0 && element.receipt ? Array.isArray(element === null || element === void 0 ? void 0 : element.receipt) ? element === null || element === void 0 ? void 0 : element.receipt : [element === null || element === void 0 ? void 0 : element.receipt] : [];
74
+ 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, {
75
+ module: 'pos',
76
+ key: 'print',
77
+ data: receipt
78
+ });
79
+ } else {
80
+ setReceiptModalShow(true);
81
+ setReceiptModalData(element === null || element === void 0 ? void 0 : element.receipt);
82
+ }
83
+ break;
84
+ }
85
+ };
86
+ useEffect(function () {
87
+ if (open && data) {
88
+ runSettlementQuery();
89
+ }
90
+ }, [open, data, runSettlementQuery]);
91
+ return /*#__PURE__*/React.createElement(PisellModal, {
92
+ open: open,
93
+ closable: false,
94
+ header: false,
95
+ footer: null,
96
+ width: 600
97
+ }, /*#__PURE__*/React.createElement("div", {
98
+ className: "pisell-eftpos-settlement-modal"
99
+ }, status === ESettlementStatus.Processing && /*#__PURE__*/React.createElement("div", {
100
+ style: {
101
+ backgroundImage: "url(".concat(prefix, "/loading.png)"),
102
+ marginBottom: '24px'
103
+ },
104
+ className: "pisell-lowcode__eft-pay-img pisell-lowcode__eft-pay-load"
105
+ }), status === ESettlementStatus.Failed && /*#__PURE__*/React.createElement("div", {
106
+ style: {
107
+ backgroundImage: "url(".concat(prefix, "/warn.png)"),
108
+ marginBottom: '24px'
109
+ },
110
+ className: "pisell-lowcode__eft-pay-img pisell-lowcode__eft-pay-warn"
111
+ }), /*#__PURE__*/React.createElement(Action, {
112
+ data: action,
113
+ onClick: onElementClick
114
+ })), receiptModalShow ? /*#__PURE__*/React.createElement(PisellModal, {
115
+ open: receiptModalShow,
116
+ onCancel: onCloseReceiptModal,
117
+ maskClosable: true,
118
+ footer: null
119
+ }, /*#__PURE__*/React.createElement("div", {
120
+ style: {
121
+ padding: '16px',
122
+ display: 'flex',
123
+ alignItems: 'center',
124
+ justifyContent: 'center'
125
+ }
126
+ }, /*#__PURE__*/React.createElement("span", {
127
+ style: {
128
+ display: 'inline-block',
129
+ whiteSpace: 'pre-wrap',
130
+ fontFamily: 'monospace',
131
+ backgroundColor: '#fff'
132
+ }
133
+ }, receiptModalData))) : null);
134
+ };
135
+ export default SettlementModal;
@@ -0,0 +1,33 @@
1
+ .pisell-eftpos-settlement-modal {
2
+ width: 100%;
3
+ min-height: 300px;
4
+ padding: 24px 0;
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ justify-content: center;
9
+ }
10
+
11
+ .pisell-eftpos-settlement-modal-step-item {
12
+ color: var(--gray-true-900, #141414);
13
+ font-size: 16px;
14
+ font-weight: 400;
15
+ }
16
+
17
+ .pisell-eftpos-settlement-modal-step-item-tip {
18
+ color: var(--gray-500, #667085);
19
+ font-size: 14px;
20
+ font-weight: 400;
21
+ }
22
+
23
+ .pisell-eftpos-settlement-modal-step-item-btns {
24
+ margin: 24px 0 0 0;
25
+ display: flex;
26
+ gap: 12px;
27
+ flex-shrink: 0;
28
+ }
29
+
30
+ .pisell-eftpos-settlement-modal-step-item-btn {
31
+ flex: 1;
32
+ height: 48px !important;
33
+ }