@pisell/private-materials 3.0.96 → 3.0.98

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 (269) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +16 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +15 -8
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/addons/model.d.ts +1 -2
  13. package/es/components/booking/forms/forms.d.ts +1 -1
  14. package/es/components/booking/forms/index.d.ts +1 -1
  15. package/es/components/booking/forms/model.d.ts +1 -2
  16. package/es/components/booking/index.d.ts +1 -1
  17. package/es/components/booking/info/index.d.ts +1 -1
  18. package/es/components/booking/info/model.d.ts +1 -2
  19. package/es/components/booking/model.d.ts +1 -2
  20. package/es/components/booking/notes/index.d.ts +1 -1
  21. package/es/components/booking/notes/model.d.ts +1 -2
  22. package/es/components/booking/payments/index.d.ts +1 -1
  23. package/es/components/booking/payments/model.d.ts +1 -2
  24. package/es/components/eftpos/const.d.ts +38 -0
  25. package/es/components/eftpos/const.js +79 -0
  26. package/es/components/eftpos/device.d.ts +8 -0
  27. package/es/components/eftpos/device.js +33 -0
  28. package/es/components/eftpos/form/index.d.ts +16 -0
  29. package/es/components/eftpos/form/index.js +113 -0
  30. package/es/components/eftpos/index.d.ts +37 -0
  31. package/es/components/eftpos/index.js +274 -0
  32. package/es/components/eftpos/index.less +169 -0
  33. package/es/components/eftpos/locales.d.ts +87 -0
  34. package/es/components/eftpos/locales.js +110 -0
  35. package/es/components/eftpos/pos.d.ts +9 -0
  36. package/es/components/eftpos/pos.js +33 -0
  37. package/es/components/eftpos/surcharge/index.css +17 -0
  38. package/es/components/eftpos/surcharge/index.d.ts +8 -0
  39. package/es/components/eftpos/surcharge/index.js +111 -0
  40. package/es/components/eftpos/table.d.ts +17 -0
  41. package/es/components/eftpos/table.js +285 -0
  42. package/es/components/eftposPay/amount.d.ts +14 -0
  43. package/es/components/eftposPay/amount.js +252 -0
  44. package/es/components/eftposPay/component/alert/index.d.ts +6 -0
  45. package/es/components/eftposPay/component/alert/index.js +11 -0
  46. package/es/components/eftposPay/component/alert/index.less +29 -0
  47. package/es/components/eftposPay/component/alert/warn.d.ts +3 -0
  48. package/es/components/eftposPay/component/alert/warn.js +45 -0
  49. package/es/components/eftposPay/component/fail/failCustom.d.ts +4 -0
  50. package/es/components/eftposPay/component/fail/failCustom.js +99 -0
  51. package/es/components/eftposPay/component/fail/index.d.ts +4 -0
  52. package/es/components/eftposPay/component/fail/index.js +109 -0
  53. package/es/components/eftposPay/component/fail/network.d.ts +4 -0
  54. package/es/components/eftposPay/component/fail/network.js +48 -0
  55. package/es/components/eftposPay/component/fail/unknow.d.ts +4 -0
  56. package/es/components/eftposPay/component/fail/unknow.js +43 -0
  57. package/es/components/eftposPay/component/header/index.d.ts +9 -0
  58. package/es/components/eftposPay/component/header/index.js +66 -0
  59. package/es/components/eftposPay/component/header/index.less +44 -0
  60. package/es/components/eftposPay/component/header/titlebar.d.ts +13 -0
  61. package/es/components/eftposPay/component/header/titlebar.js +39 -0
  62. package/es/components/eftposPay/component/header/titlebar.less +17 -0
  63. package/es/components/eftposPay/component/manual/index.d.ts +5 -0
  64. package/es/components/eftposPay/component/manual/index.js +97 -0
  65. package/es/components/eftposPay/component/manual/index.less +109 -0
  66. package/es/components/eftposPay/component/signature/index.d.ts +4 -0
  67. package/es/components/eftposPay/component/signature/index.js +63 -0
  68. package/es/components/eftposPay/component/step/index.d.ts +12 -0
  69. package/es/components/eftposPay/component/step/index.js +31 -0
  70. package/es/components/eftposPay/component/step/step.d.ts +9 -0
  71. package/es/components/eftposPay/component/step/step.js +23 -0
  72. package/es/components/eftposPay/const.d.ts +132 -0
  73. package/es/components/eftposPay/const.js +48 -0
  74. package/es/components/eftposPay/device.d.ts +14 -0
  75. package/es/components/eftposPay/device.js +124 -0
  76. package/es/components/eftposPay/device.less +61 -0
  77. package/es/components/eftposPay/eftpos/config.d.ts +11 -0
  78. package/es/components/eftposPay/eftpos/config.js +178 -0
  79. package/es/components/eftposPay/eftpos/const.d.ts +10 -0
  80. package/es/components/eftposPay/eftpos/const.js +139 -0
  81. package/es/components/eftposPay/eftpos/index.d.ts +7 -0
  82. package/es/components/eftposPay/eftpos/index.js +35 -0
  83. package/es/components/eftposPay/helper.d.ts +3 -0
  84. package/es/components/eftposPay/helper.js +35 -0
  85. package/es/components/eftposPay/hooks.d.ts +4 -0
  86. package/es/components/eftposPay/hooks.js +153 -0
  87. package/es/components/eftposPay/index.d.ts +7 -0
  88. package/es/components/eftposPay/index.js +187 -0
  89. package/es/components/eftposPay/index.less +263 -0
  90. package/es/components/eftposPay/locales.d.ts +264 -0
  91. package/es/components/eftposPay/locales.js +384 -0
  92. package/es/components/eftposPay/manufacturer.d.ts +6 -0
  93. package/es/components/eftposPay/manufacturer.js +32 -0
  94. package/es/components/eftposPay/pay.d.ts +11 -0
  95. package/es/components/eftposPay/pay.js +110 -0
  96. package/es/components/eftposPay/payo/config.d.ts +11 -0
  97. package/es/components/eftposPay/payo/config.js +357 -0
  98. package/es/components/eftposPay/payo/const.d.ts +6 -0
  99. package/es/components/eftposPay/payo/const.js +93 -0
  100. package/es/components/eftposPay/payo/hooks.d.ts +5 -0
  101. package/es/components/eftposPay/payo/hooks.js +84 -0
  102. package/es/components/eftposPay/payo/index.d.ts +7 -0
  103. package/es/components/eftposPay/payo/index.js +35 -0
  104. package/es/components/eftposPay/store/index.d.ts +239 -0
  105. package/es/components/eftposPay/store/index.js +304 -0
  106. package/es/components/eftposPay/store/useThunkReducer.d.ts +9 -0
  107. package/es/components/eftposPay/store/useThunkReducer.js +31 -0
  108. package/es/components/eftposPay/var.less +9 -0
  109. package/es/components/eftposPay/windcave/action.d.ts +8 -0
  110. package/es/components/eftposPay/windcave/action.js +104 -0
  111. package/es/components/eftposPay/windcave/const.d.ts +104 -0
  112. package/es/components/eftposPay/windcave/const.js +253 -0
  113. package/es/components/eftposPay/windcave/helper.d.ts +9 -0
  114. package/es/components/eftposPay/windcave/helper.js +314 -0
  115. package/es/components/eftposPay/windcave/hook.d.ts +14 -0
  116. package/es/components/eftposPay/windcave/hook.js +144 -0
  117. package/es/components/eftposPay/windcave/index.d.ts +8 -0
  118. package/es/components/eftposPay/windcave/index.js +49 -0
  119. package/es/components/eftposPay/windcave/pos.d.ts +8 -0
  120. package/es/components/eftposPay/windcave/pos.js +180 -0
  121. package/es/components/eftposPay/windcave/pwd.d.ts +8 -0
  122. package/es/components/eftposPay/windcave/pwd.js +124 -0
  123. package/es/components/eftposPay/windcave/receipet.d.ts +6 -0
  124. package/es/components/eftposPay/windcave/receipet.js +67 -0
  125. package/es/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  126. package/es/components/eftposPay/windcave/receiptAction.js +326 -0
  127. package/es/components/eftposPay/windcave/timer.d.ts +17 -0
  128. package/es/components/eftposPay/windcave/timer.js +181 -0
  129. package/es/components/eftposPay/windcave/wait.d.ts +12 -0
  130. package/es/components/eftposPay/windcave/wait.js +139 -0
  131. package/es/components/eftposPay/windcave/windcave.d.ts +6 -0
  132. package/es/components/eftposPay/windcave/windcave.js +283 -0
  133. package/es/components/schedules/index.d.ts +1 -1
  134. package/es/components/schedules/model.d.ts +1 -2
  135. package/es/hooks/usePrefix.d.ts +1 -0
  136. package/es/hooks/usePrefix.js +10 -0
  137. package/es/index.d.ts +2 -0
  138. package/es/index.js +3 -1
  139. package/lib/components/booking/addons/index.d.ts +1 -1
  140. package/lib/components/booking/addons/model.d.ts +1 -2
  141. package/lib/components/booking/forms/forms.d.ts +1 -1
  142. package/lib/components/booking/forms/index.d.ts +1 -1
  143. package/lib/components/booking/forms/model.d.ts +1 -2
  144. package/lib/components/booking/index.d.ts +1 -1
  145. package/lib/components/booking/info/index.d.ts +1 -1
  146. package/lib/components/booking/info/model.d.ts +1 -2
  147. package/lib/components/booking/model.d.ts +1 -2
  148. package/lib/components/booking/notes/index.d.ts +1 -1
  149. package/lib/components/booking/notes/model.d.ts +1 -2
  150. package/lib/components/booking/payments/index.d.ts +1 -1
  151. package/lib/components/booking/payments/model.d.ts +1 -2
  152. package/lib/components/eftpos/const.d.ts +38 -0
  153. package/lib/components/eftpos/const.js +108 -0
  154. package/lib/components/eftpos/device.d.ts +8 -0
  155. package/lib/components/eftpos/device.js +55 -0
  156. package/lib/components/eftpos/form/index.d.ts +16 -0
  157. package/lib/components/eftpos/form/index.js +124 -0
  158. package/lib/components/eftpos/index.d.ts +37 -0
  159. package/lib/components/eftpos/index.js +279 -0
  160. package/lib/components/eftpos/index.less +169 -0
  161. package/lib/components/eftpos/locales.d.ts +87 -0
  162. package/lib/components/eftpos/locales.js +128 -0
  163. package/lib/components/eftpos/pos.d.ts +9 -0
  164. package/lib/components/eftpos/pos.js +55 -0
  165. package/lib/components/eftpos/surcharge/index.css +17 -0
  166. package/lib/components/eftpos/surcharge/index.d.ts +8 -0
  167. package/lib/components/eftpos/surcharge/index.js +125 -0
  168. package/lib/components/eftpos/table.d.ts +17 -0
  169. package/lib/components/eftpos/table.js +260 -0
  170. package/lib/components/eftposPay/amount.d.ts +14 -0
  171. package/lib/components/eftposPay/amount.js +238 -0
  172. package/lib/components/eftposPay/component/alert/index.d.ts +6 -0
  173. package/lib/components/eftposPay/component/alert/index.js +38 -0
  174. package/lib/components/eftposPay/component/alert/index.less +29 -0
  175. package/lib/components/eftposPay/component/alert/warn.d.ts +3 -0
  176. package/lib/components/eftposPay/component/alert/warn.js +80 -0
  177. package/lib/components/eftposPay/component/fail/failCustom.d.ts +4 -0
  178. package/lib/components/eftposPay/component/fail/failCustom.js +120 -0
  179. package/lib/components/eftposPay/component/fail/index.d.ts +4 -0
  180. package/lib/components/eftposPay/component/fail/index.js +124 -0
  181. package/lib/components/eftposPay/component/fail/network.d.ts +4 -0
  182. package/lib/components/eftposPay/component/fail/network.js +65 -0
  183. package/lib/components/eftposPay/component/fail/unknow.d.ts +4 -0
  184. package/lib/components/eftposPay/component/fail/unknow.js +72 -0
  185. package/lib/components/eftposPay/component/header/index.d.ts +9 -0
  186. package/lib/components/eftposPay/component/header/index.js +92 -0
  187. package/lib/components/eftposPay/component/header/index.less +44 -0
  188. package/lib/components/eftposPay/component/header/titlebar.d.ts +13 -0
  189. package/lib/components/eftposPay/component/header/titlebar.js +55 -0
  190. package/lib/components/eftposPay/component/header/titlebar.less +17 -0
  191. package/lib/components/eftposPay/component/manual/index.d.ts +5 -0
  192. package/lib/components/eftposPay/component/manual/index.js +113 -0
  193. package/lib/components/eftposPay/component/manual/index.less +109 -0
  194. package/lib/components/eftposPay/component/signature/index.d.ts +4 -0
  195. package/lib/components/eftposPay/component/signature/index.js +80 -0
  196. package/lib/components/eftposPay/component/step/index.d.ts +12 -0
  197. package/lib/components/eftposPay/component/step/index.js +71 -0
  198. package/lib/components/eftposPay/component/step/step.d.ts +9 -0
  199. package/lib/components/eftposPay/component/step/step.js +59 -0
  200. package/lib/components/eftposPay/const.d.ts +132 -0
  201. package/lib/components/eftposPay/const.js +86 -0
  202. package/lib/components/eftposPay/device.d.ts +14 -0
  203. package/lib/components/eftposPay/device.js +127 -0
  204. package/lib/components/eftposPay/device.less +61 -0
  205. package/lib/components/eftposPay/eftpos/config.d.ts +11 -0
  206. package/lib/components/eftposPay/eftpos/config.js +199 -0
  207. package/lib/components/eftposPay/eftpos/const.d.ts +10 -0
  208. package/lib/components/eftposPay/eftpos/const.js +165 -0
  209. package/lib/components/eftposPay/eftpos/index.d.ts +7 -0
  210. package/lib/components/eftposPay/eftpos/index.js +66 -0
  211. package/lib/components/eftposPay/helper.d.ts +3 -0
  212. package/lib/components/eftposPay/helper.js +62 -0
  213. package/lib/components/eftposPay/hooks.d.ts +4 -0
  214. package/lib/components/eftposPay/hooks.js +237 -0
  215. package/lib/components/eftposPay/index.d.ts +7 -0
  216. package/lib/components/eftposPay/index.js +193 -0
  217. package/lib/components/eftposPay/index.less +263 -0
  218. package/lib/components/eftposPay/locales.d.ts +264 -0
  219. package/lib/components/eftposPay/locales.js +304 -0
  220. package/lib/components/eftposPay/manufacturer.d.ts +6 -0
  221. package/lib/components/eftposPay/manufacturer.js +77 -0
  222. package/lib/components/eftposPay/pay.d.ts +11 -0
  223. package/lib/components/eftposPay/pay.js +122 -0
  224. package/lib/components/eftposPay/payo/config.d.ts +11 -0
  225. package/lib/components/eftposPay/payo/config.js +377 -0
  226. package/lib/components/eftposPay/payo/const.d.ts +6 -0
  227. package/lib/components/eftposPay/payo/const.js +112 -0
  228. package/lib/components/eftposPay/payo/hooks.d.ts +5 -0
  229. package/lib/components/eftposPay/payo/hooks.js +80 -0
  230. package/lib/components/eftposPay/payo/index.d.ts +7 -0
  231. package/lib/components/eftposPay/payo/index.js +63 -0
  232. package/lib/components/eftposPay/store/index.d.ts +239 -0
  233. package/lib/components/eftposPay/store/index.js +371 -0
  234. package/lib/components/eftposPay/store/useThunkReducer.d.ts +9 -0
  235. package/lib/components/eftposPay/store/useThunkReducer.js +53 -0
  236. package/lib/components/eftposPay/var.less +9 -0
  237. package/lib/components/eftposPay/windcave/action.d.ts +8 -0
  238. package/lib/components/eftposPay/windcave/action.js +143 -0
  239. package/lib/components/eftposPay/windcave/const.d.ts +104 -0
  240. package/lib/components/eftposPay/windcave/const.js +300 -0
  241. package/lib/components/eftposPay/windcave/helper.d.ts +9 -0
  242. package/lib/components/eftposPay/windcave/helper.js +378 -0
  243. package/lib/components/eftposPay/windcave/hook.d.ts +14 -0
  244. package/lib/components/eftposPay/windcave/hook.js +139 -0
  245. package/lib/components/eftposPay/windcave/index.d.ts +8 -0
  246. package/lib/components/eftposPay/windcave/index.js +78 -0
  247. package/lib/components/eftposPay/windcave/pos.d.ts +8 -0
  248. package/lib/components/eftposPay/windcave/pos.js +197 -0
  249. package/lib/components/eftposPay/windcave/pwd.d.ts +8 -0
  250. package/lib/components/eftposPay/windcave/pwd.js +143 -0
  251. package/lib/components/eftposPay/windcave/receipet.d.ts +6 -0
  252. package/lib/components/eftposPay/windcave/receipet.js +93 -0
  253. package/lib/components/eftposPay/windcave/receiptAction.d.ts +11 -0
  254. package/lib/components/eftposPay/windcave/receiptAction.js +386 -0
  255. package/lib/components/eftposPay/windcave/timer.d.ts +17 -0
  256. package/lib/components/eftposPay/windcave/timer.js +126 -0
  257. package/lib/components/eftposPay/windcave/wait.d.ts +12 -0
  258. package/lib/components/eftposPay/windcave/wait.js +163 -0
  259. package/lib/components/eftposPay/windcave/windcave.d.ts +6 -0
  260. package/lib/components/eftposPay/windcave/windcave.js +283 -0
  261. package/lib/components/schedules/index.d.ts +1 -1
  262. package/lib/components/schedules/model.d.ts +1 -2
  263. package/lib/hooks/usePrefix.d.ts +1 -0
  264. package/lib/hooks/usePrefix.js +44 -0
  265. package/lib/index.d.ts +2 -0
  266. package/lib/index.js +6 -0
  267. package/lowcode/eftpos/meta.ts +187 -0
  268. package/lowcode/eftpos-pay/meta.ts +122 -0
  269. package/package.json +4 -3
@@ -0,0 +1,252 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ /* eslint-disable @typescript-eslint/no-use-before-define */
14
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
15
+ /* eslint-disable no-useless-escape */
16
+ /* eslint-disable no-restricted-globals */
17
+ import { locales } from '@pisell/utils';
18
+ import { InputNumber, Button, message } from 'antd';
19
+ import { Decimal } from 'decimal.js';
20
+ import React, { useMemo, useState } from 'react';
21
+ import Alert from "./component/alert";
22
+ import Titlebar from "./component/header/titlebar";
23
+ import { getDeviceInfo } from "./manufacturer";
24
+ import { useDispatch, useContextData, updateComponent, updateState } from "./store";
25
+ export default (function (_ref) {
26
+ var _ref$className = _ref.className,
27
+ className = _ref$className === void 0 ? '' : _ref$className,
28
+ onChange = _ref.onChange,
29
+ onClose = _ref.onClose,
30
+ _ref$formatAmount = _ref.formatAmount,
31
+ formatAmount = _ref$formatAmount === void 0 ? function (number, precision, symbol) {
32
+ return "".concat(symbol).concat(number);
33
+ } : _ref$formatAmount,
34
+ isIpad = _ref.isIpad,
35
+ net = _ref.net;
36
+ var dispatch = useDispatch();
37
+ var _useState = useState(true),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ status = _useState2[0],
40
+ setStatus = _useState2[1];
41
+ var store = useContextData();
42
+ var _getDeviceInfo = getDeviceInfo(store),
43
+ name = _getDeviceInfo.name,
44
+ symbol = _getDeviceInfo.symbol,
45
+ money = _getDeviceInfo.money,
46
+ lastMoney = _getDeviceInfo.amount,
47
+ surRate = _getDeviceInfo.surRate,
48
+ surMoney = _getDeviceInfo.surMoney;
49
+ var _useState3 = useState(surRate),
50
+ _useState4 = _slicedToArray(_useState3, 2),
51
+ curSurRate = _useState4[0],
52
+ setSurRate = _useState4[1];
53
+ var _useState5 = useState(surMoney),
54
+ _useState6 = _slicedToArray(_useState5, 2),
55
+ curSurMoney = _useState6[0],
56
+ setSurMoney = _useState6[1];
57
+ var _useState7 = useState(lastMoney),
58
+ _useState8 = _slicedToArray(_useState7, 2),
59
+ currentMoney = _useState8[0],
60
+ setCurrentMoney = _useState8[1];
61
+ var _useState9 = useState(curSurRate),
62
+ _useState10 = _slicedToArray(_useState9, 2),
63
+ tempSurRate = _useState10[0],
64
+ setTempSurRate = _useState10[1];
65
+ var _useState11 = useState(curSurMoney),
66
+ _useState12 = _slicedToArray(_useState11, 2),
67
+ tempSurMoney = _useState12[0],
68
+ setTempSurMoney = _useState12[1];
69
+ var surRateMoney = useMemo(function () {
70
+ var surRateDeci = new Decimal(curSurRate);
71
+ var moneyDeci = new Decimal(currentMoney);
72
+ return moneyDeci.mul(surRateDeci.div(100)).toFixed(2, Decimal.ROUND_HALF_UP);
73
+ }, [currentMoney, curSurRate]);
74
+ var totalSurMoney = useMemo(function () {
75
+ var surRateDeci = new Decimal(curSurRate);
76
+ var moneyDeci = new Decimal(currentMoney);
77
+ var surMoneyDeci = new Decimal(curSurMoney);
78
+ return moneyDeci.mul(surRateDeci.div(100)).add(surMoneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
79
+ }, [currentMoney, curSurRate, curSurMoney]);
80
+ var total = useMemo(function () {
81
+ var totalSurDeci = new Decimal(totalSurMoney);
82
+ var moneyDeci = new Decimal(currentMoney);
83
+ return totalSurDeci.add(moneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
84
+ }, [currentMoney, totalSurMoney]);
85
+ var subtracted = useMemo(function () {
86
+ var moneyDeci = new Decimal(money);
87
+ var currentMoneyDeci = new Decimal(currentMoney);
88
+ return moneyDeci.sub(currentMoneyDeci).toFixed(2, Decimal.ROUND_HALF_UP);
89
+ }, [currentMoney, money]);
90
+ var onBack = function onBack() {
91
+ setStatus(true);
92
+ };
93
+ var onSubmit = function onSubmit() {
94
+ if (!status) {
95
+ setStatus(true);
96
+ setSurRate(tempSurRate);
97
+ setSurMoney(tempSurMoney);
98
+ return;
99
+ }
100
+ if (!net) {
101
+ message.open({
102
+ key: 'net-warning',
103
+ type: 'warning',
104
+ content: locales.getText('page.eftpos-pay.text.not.connected')
105
+ });
106
+ return;
107
+ }
108
+ var rate = new Decimal(curSurRate).div(100).toFixed(4, Decimal.ROUND_HALF_UP);
109
+ var pay = {
110
+ sourceAmount: "".concat(money),
111
+ amount: "".concat(currentMoney),
112
+ surcharge: "".concat(totalSurMoney),
113
+ total: "".concat(total),
114
+ surPercentRate: "".concat(rate),
115
+ surRate: "".concat(curSurRate),
116
+ surMoney: "".concat(curSurMoney),
117
+ surRateMoney: "".concat(surRateMoney),
118
+ totalUnit: formatAmount(total, 2, symbol)
119
+ };
120
+ console.log('surRateMoney = ', surRateMoney);
121
+ dispatch(updateState({
122
+ custom: store.custom ? _objectSpread(_objectSpread({}, store.custom), {}, {
123
+ pay: pay
124
+ }) : {
125
+ pay: pay
126
+ }
127
+ }));
128
+ dispatch(updateComponent(''));
129
+ onChange && onChange('page', 'pay');
130
+ // 下一步
131
+ };
132
+
133
+ var onCancel = function onCancel() {
134
+ if (!status) {
135
+ setStatus(true);
136
+ return;
137
+ }
138
+ onClose();
139
+ };
140
+ var onEdit = function onEdit() {
141
+ setStatus(false);
142
+ setTempSurRate(curSurRate);
143
+ setTempSurMoney(curSurMoney);
144
+ };
145
+ return /*#__PURE__*/React.createElement("div", {
146
+ className: "pisell-lowcode__eft-pay-amount ".concat(className)
147
+ }, isIpad ? null : /*#__PURE__*/React.createElement(Titlebar, {
148
+ type: 'left-title-close',
149
+ onClose: onClose
150
+ }, status ? name : locales.getText('page.eftpos-pay.text.surcharge.edit.title')), status ? /*#__PURE__*/React.createElement("div", {
151
+ className: "pisell-lowcode__eft-pay-amount-body"
152
+ }, /*#__PURE__*/React.createElement("div", {
153
+ className: "pisell-lowcode__eft-pay-cash",
154
+ "data-money": formatAmount(money, 2, symbol)
155
+ // format.replace(/{{.+}}/, `${money}`)
156
+ }, locales.getText('page.eftpos-pay.text.amount.to.pay')), /*#__PURE__*/React.createElement("div", {
157
+ className: "pisell-lowcode__eft-pay-money"
158
+ }, /*#__PURE__*/React.createElement("div", {
159
+ className: "pisell-lowcode__eft-pay-money-title"
160
+ }, locales.getText('page.eftpos-pay.text.input.title')(name)), /*#__PURE__*/React.createElement(InputNumber, {
161
+ addonBefore: symbol || '$',
162
+ max: money,
163
+ precision: 2,
164
+ min: 0,
165
+ style: {
166
+ width: '100%'
167
+ },
168
+ value: currentMoney,
169
+ formatter: limitDecimals,
170
+ parser: limitDecimals,
171
+ onChange: function onChange(event) {
172
+ if (event !== null && event !== undefined) {
173
+ setCurrentMoney(event || 0);
174
+ } else {
175
+ setCurrentMoney(0);
176
+ }
177
+ }
178
+ }), /*#__PURE__*/React.createElement("div", {
179
+ className: "pisell-lowcode__eft-pay-money-tip"
180
+ }, locales.getText('page.eftpos-pay.text.amount.cash.left.pay.paid')(formatAmount("".concat(subtracted), 2, symbol)))), /*#__PURE__*/React.createElement("div", {
181
+ className: "pisell-lowcode__eft-pay-surcharge"
182
+ }, /*#__PURE__*/React.createElement("div", {
183
+ className: "pisell-lowcode__eft-pay-details"
184
+ }, /*#__PURE__*/React.createElement("div", {
185
+ className: "pisell-lowcode__eft-pay-total"
186
+ }, locales.getText('page.eftpos-pay.text.surcharge.edit.actual.pay'), ":", formatAmount("".concat(total), 2, symbol)), /*#__PURE__*/React.createElement("div", {
187
+ className: "pisell-lowcode__eft-pay-money"
188
+ }, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(totalSurMoney), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", curSurRate, "% + ", formatAmount("".concat(curSurMoney), 2, symbol), ")")), /*#__PURE__*/React.createElement(Button, {
189
+ type: "link",
190
+ onClick: onEdit
191
+ }, locales.getText('page.eftpos-pay.text.surcharge.edit.surcharge')))) : /*#__PURE__*/React.createElement("div", {
192
+ className: "pisell-lowcode__eft-pay-amount-body"
193
+ }, /*#__PURE__*/React.createElement(Alert, null, locales.getText('page.eftpos-pay.text.surcharge.percentage-fixed')), /*#__PURE__*/React.createElement("div", {
194
+ className: "pisell-lowcode__eft-pay-amount-form"
195
+ }, /*#__PURE__*/React.createElement("div", {
196
+ className: "pisell-lowcode__eft-pay-amount-item"
197
+ }, /*#__PURE__*/React.createElement("div", {
198
+ className: "pisell-lowcode__eft-pay-amount-item-title"
199
+ }, locales.getText('page.eftpos-pay.text.surcharge.percentage')), /*#__PURE__*/React.createElement(InputNumber, {
200
+ value: tempSurRate,
201
+ min: 0,
202
+ max: 100,
203
+ precision: 2,
204
+ addonAfter: "%",
205
+ style: {
206
+ width: '100%'
207
+ },
208
+ onChange: function onChange(e) {
209
+ setTempSurRate(e || 0);
210
+ }
211
+ })), /*#__PURE__*/React.createElement("div", {
212
+ className: "pisell-lowcode__eft-pay-amount-item"
213
+ }, /*#__PURE__*/React.createElement("div", {
214
+ className: "pisell-lowcode__eft-pay-amount-item-title"
215
+ }, locales.getText('page.eftpos-pay.text.surcharge.fixed')), /*#__PURE__*/React.createElement(InputNumber, {
216
+ value: tempSurMoney,
217
+ min: 0,
218
+ max: 100000,
219
+ precision: 2,
220
+ style: {
221
+ width: '100%'
222
+ },
223
+ addonBefore: symbol || '$',
224
+ onChange: function onChange(e) {
225
+ setTempSurMoney(e || 0);
226
+ }
227
+ })))), /*#__PURE__*/React.createElement("div", {
228
+ className: "pisell-lowcode__eft-pay-step-item-btns"
229
+ }, /*#__PURE__*/React.createElement(Button, {
230
+ block: true,
231
+ className: "pisell-lowcode__eft-pay-step-item-btn",
232
+ onClick: onCancel
233
+ }, locales.getText('page.eftpos-pay.text.cancel')), /*#__PURE__*/React.createElement(Button, {
234
+ block: true,
235
+ className: "pisell-lowcode__eft-pay-step-item-btn",
236
+ type: "primary",
237
+ onClick: onSubmit,
238
+ disabled: currentMoney <= 0 && status
239
+ }, locales.getText('page.eftpos-pay.text.sure'))));
240
+ });
241
+
242
+ // inputNumber过滤
243
+ export var limitDecimals = function limitDecimals(value) {
244
+ var reg = /^(\-)*(\d+)\.(\d\d).*$/;
245
+ if (typeof value === 'string') {
246
+ return !isNaN(Number(value)) ? value.replace(reg, '$1$2.$3') : '';
247
+ }
248
+ if (typeof value === 'number') {
249
+ return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : '';
250
+ }
251
+ return '';
252
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const _default: ({ children }: {
4
+ children: React.ReactNode;
5
+ }) => React.JSX.Element;
6
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Warn from "./warn";
3
+ import "./index.less";
4
+ export default (function (_ref) {
5
+ var children = _ref.children;
6
+ return /*#__PURE__*/React.createElement("div", {
7
+ className: "pisell-lowcode__alert-warn-box"
8
+ }, /*#__PURE__*/React.createElement("div", {
9
+ className: "pisell-lowcode__alert-warn"
10
+ }, /*#__PURE__*/React.createElement(Warn, null)), children);
11
+ });
@@ -0,0 +1,29 @@
1
+ .pisell-lowcode__alert-warn-box{
2
+ align-items: center;
3
+ display: flex;
4
+ padding: 8px 16px;
5
+ gap: 16px;
6
+ align-self: stretch;
7
+
8
+ border-radius: 12px;
9
+ border: 1px solid var(--Warning-300, #fec84b);
10
+ background: var(--Warning-25, #fffcf5);
11
+
12
+ /* Shadow/xs */
13
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
14
+
15
+ color: var(--Warning-700, #b54708);
16
+ font-size: 14px;
17
+ font-style: normal;
18
+ font-weight: 600;
19
+ line-height: 20px; /* 142.857% */
20
+ }
21
+ .pisell-lowcode__alert-warn{
22
+ position: relative;
23
+ font-size: 36px;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ font-size: 36px;
28
+ flex-wrap: wrap;
29
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ export default (function () {
3
+ return /*#__PURE__*/React.createElement("svg", {
4
+ width: "1em",
5
+ height: "1em",
6
+ viewBox: "0 0 36 36",
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ fill: "none"
9
+ }, /*#__PURE__*/React.createElement("g", {
10
+ opacity: "0.3"
11
+ }, /*#__PURE__*/React.createElement("rect", {
12
+ x: "5.49999",
13
+ y: "5.5013",
14
+ width: "25",
15
+ height: "25",
16
+ rx: "12.5",
17
+ stroke: "#DC6803",
18
+ strokeWidth: "1.66667"
19
+ })), /*#__PURE__*/React.createElement("g", {
20
+ opacity: "0.1"
21
+ }, /*#__PURE__*/React.createElement("rect", {
22
+ x: "1.33333",
23
+ y: "1.33333",
24
+ width: "33.3333",
25
+ height: "33.3333",
26
+ rx: "16.6667",
27
+ stroke: "#DC6803",
28
+ strokeWidth: "1.66667"
29
+ })), /*#__PURE__*/React.createElement("g", {
30
+ clipPath: "url(#clip0_5109_25282)"
31
+ }, /*#__PURE__*/React.createElement("path", {
32
+ d: "M18 14.668V18.0013M18 21.3346H18.0083M26.3333 18.0013C26.3333 22.6037 22.6024 26.3346 18 26.3346C13.3976 26.3346 9.66666 22.6037 9.66666 18.0013C9.66666 13.3989 13.3976 9.66797 18 9.66797C22.6024 9.66797 26.3333 13.3989 26.3333 18.0013Z",
33
+ stroke: "#DC6803",
34
+ strokeWidth: "1.66667",
35
+ strokeLinecap: "round",
36
+ strokeLinejoin: "round"
37
+ })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
38
+ id: "clip0_5109_25282"
39
+ }, /*#__PURE__*/React.createElement("rect", {
40
+ width: "20",
41
+ height: "20",
42
+ fill: "white",
43
+ transform: "translate(8 8)"
44
+ }))));
45
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ActionProps } from '../../const';
3
+ declare const _default: ({ className, isIpad, onChange }: ActionProps) => React.JSX.Element;
4
+ export default _default;
@@ -0,0 +1,99 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ /* eslint-disable no-nested-ternary */
8
+ import { locales } from '@pisell/utils';
9
+ import { useMount } from 'ahooks';
10
+ import { Button } from 'antd';
11
+ import React from 'react';
12
+ import { ModeEnum } from "../../const";
13
+ import { getInitState } from "../../manufacturer";
14
+ import XClose from '@pisell/icon/es/XClose';
15
+ import { useDispatch, useContextData, updateState, updateComponent } from "../../store";
16
+ import Header from "../header";
17
+ export default (function (_ref) {
18
+ var _ref$className = _ref.className,
19
+ className = _ref$className === void 0 ? '' : _ref$className,
20
+ isIpad = _ref.isIpad,
21
+ onChange = _ref.onChange;
22
+ var _useContextData = useContextData(),
23
+ eftpos = _useContextData.eftpos,
24
+ custom = _useContextData.custom,
25
+ mode = _useContextData.mode;
26
+ var failCustom = custom === null || custom === void 0 ? void 0 : custom.failCustom;
27
+ var dispatch = useDispatch();
28
+ var onRetry = function onRetry() {
29
+ onChange('page', 'pay');
30
+ dispatch(updateState(getInitState(eftpos, mode === ModeEnum.Query ? _objectSpread(_objectSpread({}, custom), {}, {
31
+ isPay: true
32
+ }) : _objectSpread(_objectSpread({}, custom), {}, {
33
+ number: undefined,
34
+ isPay: false
35
+ }))));
36
+ };
37
+ var onModify = function onModify() {
38
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
39
+ number: undefined,
40
+ isPay: false
41
+ }))));
42
+ onChange('page', 'amount');
43
+ };
44
+ var onManually = function onManually() {
45
+ dispatch(updateState({
46
+ manual: {
47
+ title: locales.getText('page.eftpos-pay.text.request.title')(mode),
48
+ text: locales.getText('page.eftpos-pay.text.request.text')(mode)
49
+ }
50
+ }));
51
+ dispatch(updateComponent('Manual'));
52
+ };
53
+ var onClose = function onClose() {
54
+ onChange('fail');
55
+ };
56
+ useMount(function () {
57
+ if ((failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail') {
58
+ onChange('page', 'fail');
59
+ }
60
+ });
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: "pisell-lowcode__eft-pay-box ".concat(className)
63
+ }, /*#__PURE__*/React.createElement(Header, {
64
+ status: failCustom.status
65
+ }, (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' && !isIpad ? /*#__PURE__*/React.createElement(XClose, {
66
+ size: 20,
67
+ style: {
68
+ fontSize: '24px',
69
+ position: 'absolute',
70
+ top: 0,
71
+ right: 0
72
+ },
73
+ onClick: onClose
74
+ }) : null), /*#__PURE__*/React.createElement("div", {
75
+ className: "pisell-lowcode__eft-pay-fail-title"
76
+ }, failCustom.title || locales.getText('page.eftpos-pay.text.failed')(mode)), (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'fail' ? /*#__PURE__*/React.createElement("div", {
77
+ className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body"
78
+ }, failCustom === null || failCustom === void 0 ? void 0 : failCustom.fail) : (failCustom === null || failCustom === void 0 ? void 0 : failCustom.status) === 'warn' ? /*#__PURE__*/React.createElement("div", {
79
+ className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
80
+ }, failCustom === null || failCustom === void 0 ? void 0 : failCustom.warn) : null, failCustom !== null && failCustom !== void 0 && failCustom.isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
81
+ className: "pisell-lowcode__eft-pay-step-item-btns"
82
+ }, /*#__PURE__*/React.createElement(Button, {
83
+ block: true,
84
+ className: "pisell-lowcode__eft-pay-step-item-btn",
85
+ onClick: onManually
86
+ }, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
87
+ className: "pisell-lowcode__eft-pay-step-item-btns"
88
+ }, /*#__PURE__*/React.createElement(Button, {
89
+ block: true,
90
+ className: "pisell-lowcode__eft-pay-step-item-btn",
91
+ onClick: onRetry
92
+ }, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
93
+ block: true,
94
+ className: "pisell-lowcode__eft-pay-step-item-btn",
95
+ type: "primary",
96
+ onClick: onModify,
97
+ disabled: mode !== ModeEnum.Pay
98
+ }, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
99
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ActionProps } from '../../const';
3
+ declare const _default: ({ onChange, className, isIpad }: ActionProps) => React.JSX.Element;
4
+ export default _default;
@@ -0,0 +1,109 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ /* eslint-disable no-nested-ternary */
8
+ import { locales } from '@pisell/utils';
9
+ import { Button } from 'antd';
10
+ import { useMount } from 'ahooks';
11
+ import React from 'react';
12
+ import XClose from '@pisell/icon/es/XClose';
13
+ import { getInitState } from "../../manufacturer";
14
+ import { useDispatch, useContextData, updateState, updateCustomStemItem, updateComponent } from "../../store";
15
+ import Header from "../header";
16
+ export default (function (_ref) {
17
+ var _steps$step, _steps$step$custom;
18
+ var onChange = _ref.onChange,
19
+ _ref$className = _ref.className,
20
+ className = _ref$className === void 0 ? '' : _ref$className,
21
+ isIpad = _ref.isIpad;
22
+ var _useContextData = useContextData(),
23
+ eftpos = _useContextData.eftpos,
24
+ step = _useContextData.step,
25
+ steps = _useContextData.steps,
26
+ custom = _useContextData.custom,
27
+ mode = _useContextData.mode;
28
+ var isPosNetworkError = ((_steps$step = steps[step]) === null || _steps$step === void 0 ? void 0 : (_steps$step$custom = _steps$step.custom) === null || _steps$step$custom === void 0 ? void 0 : _steps$step$custom.isPosNetworkError) || false;
29
+ var dispatch = useDispatch();
30
+ var onRetry = function onRetry() {
31
+ onChange('page', 'pay');
32
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
33
+ number: undefined
34
+ }))));
35
+ dispatch(updateCustomStemItem({
36
+ custom: {
37
+ status: undefined
38
+ },
39
+ step: step
40
+ }));
41
+ };
42
+ var onModify = function onModify() {
43
+ dispatch(updateState(getInitState(eftpos, _objectSpread(_objectSpread({}, custom), {}, {
44
+ number: undefined
45
+ }))));
46
+ dispatch(updateCustomStemItem({
47
+ custom: {
48
+ status: undefined
49
+ },
50
+ step: step
51
+ }));
52
+ onChange('page', 'amount');
53
+ };
54
+ var onManually = function onManually() {
55
+ dispatch(updateState({
56
+ manual: {
57
+ title: locales.getText('page.eftpos-pay.text.timedout.title'),
58
+ text: locales.getText('page.eftpos-pay.text.timedout.text')(mode)
59
+ }
60
+ }));
61
+ dispatch(updateComponent('Manual'));
62
+ };
63
+ var onClose = function onClose() {
64
+ // 支付失败页
65
+ onChange('fail');
66
+ };
67
+ useMount(function () {
68
+ if (steps[step].status === 'fail') {
69
+ onChange('page', 'fail');
70
+ }
71
+ });
72
+ return /*#__PURE__*/React.createElement("div", {
73
+ className: "pisell-lowcode__eft-pay-box ".concat(className)
74
+ }, /*#__PURE__*/React.createElement(Header, {
75
+ status: steps[step].status
76
+ }, steps[step].status === 'fail' && !isIpad ? /*#__PURE__*/React.createElement(XClose, {
77
+ size: 20,
78
+ style: {
79
+ fontSize: '24px',
80
+ position: 'absolute',
81
+ top: 0,
82
+ right: 0
83
+ },
84
+ onClick: onClose
85
+ }) : null), /*#__PURE__*/React.createElement("div", {
86
+ className: "pisell-lowcode__eft-pay-fail-title"
87
+ }, steps[step].title || locales.getText('page.eftpos-pay.text.failed')(mode)), steps[step].status === 'fail' ? /*#__PURE__*/React.createElement("div", {
88
+ className: "pisell-lowcode__eft-pay-fail-text pisell-lowcode__eft-pay-body"
89
+ }, steps[step].fail) : steps[step].status === 'warn' ? /*#__PURE__*/React.createElement("div", {
90
+ className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
91
+ }, steps[step].warn) : null, isPosNetworkError ? /*#__PURE__*/React.createElement("div", {
92
+ className: "pisell-lowcode__eft-pay-step-item-btns"
93
+ }, /*#__PURE__*/React.createElement(Button, {
94
+ block: true,
95
+ className: "pisell-lowcode__eft-pay-step-item-btn",
96
+ onClick: onManually
97
+ }, locales.getText('page.eftpos-pay.text.manual.marking'))) : /*#__PURE__*/React.createElement("div", {
98
+ className: "pisell-lowcode__eft-pay-step-item-btns"
99
+ }, /*#__PURE__*/React.createElement(Button, {
100
+ block: true,
101
+ className: "pisell-lowcode__eft-pay-step-item-btn",
102
+ onClick: onRetry
103
+ }, locales.getText('page.eftpos-pay.text.retry')), /*#__PURE__*/React.createElement(Button, {
104
+ block: true,
105
+ className: "pisell-lowcode__eft-pay-step-item-btn",
106
+ type: "primary",
107
+ onClick: onModify
108
+ }, locales.getText('page.eftpos-pay.text.modify.payment.info')(mode))));
109
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ActionProps } from '../../const';
3
+ declare const _default: ({ className }: ActionProps) => React.JSX.Element;
4
+ export default _default;
@@ -0,0 +1,48 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { locales } from '@pisell/utils';
8
+ import React, { useEffect, useState } from 'react';
9
+ import { Button, message } from 'antd';
10
+ import Header from "../header";
11
+ export default (function (_ref) {
12
+ var _ref$className = _ref.className,
13
+ className = _ref$className === void 0 ? '' : _ref$className;
14
+ var _useState = useState(false),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ hasBtn = _useState2[0],
17
+ setBtn = _useState2[1];
18
+ useEffect(function () {
19
+ var clear = setTimeout(function () {
20
+ setBtn(true);
21
+ }, 1000);
22
+ return function () {
23
+ clearTimeout(clear);
24
+ };
25
+ }, []);
26
+ var onReconnect = function onReconnect() {
27
+ message.open({
28
+ key: 'net-warning',
29
+ type: 'loading',
30
+ content: locales.getText('page.eftpos-pay.text.reconnecting')
31
+ });
32
+ };
33
+ return /*#__PURE__*/React.createElement("div", {
34
+ className: "pisell-lowcode__eft-pay-box ".concat(className)
35
+ }, /*#__PURE__*/React.createElement(Header, {
36
+ status: "warn"
37
+ }), /*#__PURE__*/React.createElement("div", {
38
+ className: "pisell-lowcode__eft-pay-fail-title"
39
+ }, locales.getText('page.eftpos-pay.text.network.disconnected')), /*#__PURE__*/React.createElement("div", {
40
+ className: "pisell-lowcode__eft-pay-warn-text pisell-lowcode__eft-pay-body"
41
+ }, locales.getText('page.eftpos-pay.text.waiting.wifi.title'), " ", /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.connection'), /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.router'), /*#__PURE__*/React.createElement("br", null), locales.getText('page.eftpos-pay.text.waiting.wifi.forget.reconnect')), hasBtn ? /*#__PURE__*/React.createElement("div", {
42
+ className: "pisell-lowcode__eft-pay-step-item-btns"
43
+ }, /*#__PURE__*/React.createElement(Button, {
44
+ block: true,
45
+ className: "pisell-lowcode__eft-pay-step-item-btn",
46
+ onClick: onReconnect
47
+ }, locales.getText('page.eftpos-pay.text.reconnect.network'))) : null);
48
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ActionProps } from '../../const';
3
+ declare const _default: ({ className }: ActionProps) => React.JSX.Element;
4
+ export default _default;